
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>注入 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="5.4.html" />
    
    
    <link rel="prev" href="5.2.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" >
            
                <a target="_blank" href="https://github.com/xfl03/CoreModTutor">
            
                    
                    源代码仓库（求star）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="./">
            
                <a href="./">
            
                    
                    目录
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="0.html">
            
                <a href="0.html">
            
                    
                    0 绪论
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" >
            
                <span>
            
                    
                    1 简介
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="1.1.html">
            
                <a href="1.1.html">
            
                    
                    CoreMod
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="1.2.html">
            
                <a href="1.2.html">
            
                    
                    Java虚拟机
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="1.3.html">
            
                <a href="1.3.html">
            
                    
                    Minecraft混淆方式
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" >
            
                <span>
            
                    
                    2 Java虚拟机
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" >
            
                <span>
            
                    
                    ClassLoader类加载器
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" >
            
                <span>
            
                    
                    ByteCode字节码
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" >
            
                <span>
            
                    
                    ASM
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" >
            
                <span>
            
                    
                    3 原版 CoreMod
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="3.1.html">
            
                <a href="3.1.html">
            
                    
                    直接修改class文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="3.2.html">
            
                <a href="3.2.html">
            
                    
                    JavaAgent
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="3.3.html">
            
                <a href="3.3.html">
            
                    
                    LaunchWrapper
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="3.4.html">
            
                <a href="3.4.html">
            
                    
                    ModLauncher
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" >
            
                <span>
            
                    
                    4 FML CoreMod
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="4.1.html">
            
                <a href="4.1.html">
            
                    
                    1.3.2-1.5.2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="4.2.html">
            
                <a href="4.2.html">
            
                    
                    1.6.1-1.12.2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="4.3.html">
            
                <a href="4.3.html">
            
                    
                    1.13.2-1.14.4
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="5.html">
            
                <a href="5.html">
            
                    
                    5 Mixin
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="5.1.html">
            
                <a href="5.1.html">
            
                    
                    配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="5.2.html">
            
                <a href="5.2.html">
            
                    
                    引导
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.8.3" data-path="5.3.html">
            
                <a href="5.3.html">
            
                    
                    注入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="5.4.html">
            
                <a href="5.4.html">
            
                    
                    修改
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.5" data-path="5.5.html">
            
                <a href="5.5.html">
            
                    
                    定位
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.6" data-path="5.6.html">
            
                <a href="5.6.html">
            
                    
                    融合
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.7" data-path="5.7.html">
            
                <a href="5.7.html">
            
                    
                    扩展
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.8" data-path="5.8.html">
            
                <a href="5.8.html">
            
                    
                    调试
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" >
            
                <span>
            
                    
                    附录
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="附录A.html">
            
                <a href="附录A.html">
            
                    
                    附录A 相关工具下载
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" data-path="附录B.html">
            
                <a href="附录B.html">
            
                    
                    附录B 常见Java字节码指令表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.3" data-path="附录C.html">
            
                <a href="附录C.html">
            
                    
                    附录C 参考资料
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >注入</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x6CE8;&#x5165;">&#x6CE8;&#x5165;</h1>
<p>Mixin&#x63D0;&#x4F9B;&#x4E86;&#x4E00;&#x5957;&#x4E30;&#x5BCC;&#x7684;&#x6CE8;&#x89E3;&#x5E93;&#xFF0C;&#x7528;&#x4E8E;&#x6807;&#x8BB0;&#x4E0D;&#x540C;&#x7684;&#x6CE8;&#x5165;&#x65B9;&#x5F0F;&#x3002;<br>Mixin&#x6CE8;&#x5165;&#x539F;&#x7406;&#x53C2;&#x8003;<a href="https://github.com/SpongePowered/Mixin/wiki/Flippin&apos;-Mixins,-how-do-they-work%3F" target="_blank">Flippin&apos; Mixins, how do they work?</a>&#xFF0C;&#x7B80;&#x800C;&#x8A00;&#x4E4B;&#xFF0C;Mixin&#x6CE8;&#x5165;&#x7C7B;&#x4E2D;&#x7684;&#x5927;&#x90E8;&#x5206;&#x65B9;&#x6CD5;&#xFF0C;&#x4EE5;&#x53CA;&#x67D0;&#x4E9B;&#x5B57;&#x6BB5;&#x6700;&#x540E;&#x4F1A;&#x5408;&#x5E76;&#x5230;&#x76EE;&#x6807;&#x7C7B;&#x4E2D;&#x3002;</p>
<p>&#x5EFA;&#x8BAE;&#x914D;&#x5408;<a href="http://jenkins.liteloader.com/job/Mixin/javadoc/" target="_blank">&#x5B98;&#x65B9;&#x6587;&#x6863;</a>&#x4F7F;&#x7528;&#x3002;</p>
<p>&#x63A5;&#x4E0B;&#x6765;&#x5C06;&#x4EE5;&#x82B1;&#x5F0F;&#x4FEE;&#x6539;Minecraft&#x7A97;&#x4F53;&#x6807;&#x9898;&#x4E3A;&#x4F8B;&#x3002;</p>
<h2 id="&#x521B;&#x5EFA;mixin&#x6CE8;&#x5165;&#x7C7B;">&#x521B;&#x5EFA;Mixin&#x6CE8;&#x5165;&#x7C7B;</h2>
<ol>
<li>&#x5728;json&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x4E2D;&#x6307;&#x5B9A;&#x7684;&#x5305;&#x4E0B;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x65B0;&#x7684;&#x7C7B;&#xFF08;&#x672C;&#x6559;&#x7A0B;&#x4EE5;<code>com.example.mixins</code>&#x4E3A;&#x4F8B;&#xFF09;&#xFF0C;&#x7C7B;&#x540D;&#x5EFA;&#x8BAE;&#x4EE5;&#x300C;Mixin + &#x76EE;&#x6807;&#x7C7B;&#x540D;&#x300D;&#x7684;&#x5F62;&#x5F0F;&#x547D;&#x540D;&#x3002;&#x56E0;&#x4E3A;&#x6807;&#x9898;&#x76F8;&#x5173;&#x5185;&#x5BB9;&#x662F;&#x5728;<code>Minecraft</code>&#x7C7B;&#x4E2D;&#x5B9A;&#x4E49;&#x7684;&#xFF0C;&#x6240;&#x4EE5;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x540D;&#x4E3A; <code>MixinMinecraft</code> &#x7684;&#x7C7B;&#x3002;&#x6CE8;&#x5165;&#x7C7B;&#x5EFA;&#x8BAE;&#x52A0;&#x4E0A;<code>abstract</code>&#x5173;&#x952E;&#x8BCD;&#x3002;</li>
<li><p>&#x5728;&#x7C7B;&#x4E0A;&#x6DFB;&#x52A0;<code>@Mixin</code>&#x6CE8;&#x89E3;&#xFF0C;&#x6B64;&#x6CE8;&#x89E3;&#x6709;&#x4EE5;&#x4E0B;&#x5C5E;&#x6027;&#xFF1A;</p>
<ul>
<li><code>value</code>: &#x7528;&#x4E8E;&#x6807;&#x8BB0;&#x4E00;&#x4E2A;&#x6216;&#x591A;&#x4E2A;&#x76EE;&#x6807;&#x7C7B;&#xFF0C;&#x6BD4;&#x5982; <code>Minecraft.class</code></li>
<li><code>targets</code>: &#x540C;&#x4E0A;&#xFF0C;&#x53EA;&#x4E0D;&#x8FC7;&#x662F;&#x7528;&#x4E8E;&#x6807;&#x8BB0;&#x975E;&#x516C;&#x6709;&#x7C7B;&#x6216;&#x533F;&#x540D;&#x7C7B;&#xFF0C;&#x6BD4;&#x5982; <code>com.example.ExampleClass$1</code></li>
<li><code>priority</code>: &#x8BBE;&#x7F6E;&#x6B64;&#x6CE8;&#x5165;&#x7C7B;&#x6CE8;&#x5165;&#x7684;&#x4F18;&#x5148;&#x7EA7;</li>
<li><p><code>remap</code>: &#x5982;&#x679C;&#x76EE;&#x6807;&#x7C7B;&#x5728;MixinGradle&#x4E2D;&#x8BBE;&#x7F6E;&#x7684;&#x6DF7;&#x6DC6;&#x8868;&#x4E2D;&#x4E0D;&#x5B58;&#x5728;&#xFF0C;&#x90A3;&#x4E48;&#x5EFA;&#x8BAE;&#x5C06;&#x6B64;&#x5C5E;&#x6027;&#x8BBE;&#x4E3A;<code>true</code>&#xFF0C;&#x5426;&#x5219;&#x7F16;&#x8BD1;&#x65F6;&#x4F1A;&#x629B;&#x51FA;&#x4E00;&#x4E2A;&#x8B66;&#x544A;</p>
<p>&#x6240;&#x4EE5;&#x4E00;&#x4E2A;&#x6700;&#x57FA;&#x672C;&#x7684;&#x6CE8;&#x5165;&#x7C7B;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-java"><span class="hljs-keyword">package</span> com.example.mixins;

<span class="hljs-keyword">import</span> net.minecraft.client.Minecraft;
<span class="hljs-keyword">import</span> org.spongepowered.asm.mixin.Mixin;

<span class="hljs-meta">@Mixin</span>(Minecraft.class)
<span class="hljs-keyword">public</span> <span class="hljs-keyword">abstract</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MixinMinecraft</span> </span>{

}
</code></pre>
</li>
</ul>
</li>
</ol>
<h2 id="&#x5F00;&#x59CB;&#x6CE8;&#x5165;">&#x5F00;&#x59CB;&#x6CE8;&#x5165;</h2>
<p>&#x9996;&#x5148;&#x9700;&#x8981;&#x4E86;&#x89E3;&#x7684;&#x4E00;&#x4E2A;&#x57FA;&#x672C;&#x539F;&#x7406;&#xFF1A;Mixin&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x628A;&#x6CE8;&#x5165;&#x7C7B;&#x5408;&#x5E76;&#x5230;&#x76EE;&#x6807;&#x7C7B;&#x4E2D;&#x53BB;&#x3002;&#x867D;&#x7136;&#x4E0D;&#x662F;&#x7B80;&#x5355;&#x7684;&#x76F4;&#x63A5;&#x5408;&#x5E76;&#xFF0C;&#x4E0D;&#x8FC7;&#x4E3A;&#x4E86;&#x4E4B;&#x540E;&#x7684;&#x65B9;&#x4FBF;&#x89E3;&#x91CA;&#xFF0C;&#x76EE;&#x524D;&#x53EF;&#x4EE5;&#x8FD9;&#x4E48;&#x7406;&#x89E3;&#x3002;<br>Mixin&#x4F9D;&#x9760;&#x4E00;&#x5957;&#x5F3A;&#x5927;&#x800C;&#x53C8;&#x5B8C;&#x5907;&#x7684;&#x6CE8;&#x89E3;&#x7CFB;&#x7EDF;&#x8FD0;&#x4F5C;&#xFF0C;&#x901A;&#x8FC7;&#x6CE8;&#x89E3;&#x8BC6;&#x522B;&#x5982;&#x4F55;&#x6CE8;&#x5165;&#x4FEE;&#x6539;&#x65B9;&#x6CD5;&#x3002;<br>&#x6211;&#x4EEC;&#x8FD8;&#x662F;&#x4EE5;&#x4FEE;&#x6539;&#x7A97;&#x4F53;&#x6807;&#x9898;&#x4E3A;&#x4F8B;&#xFF0C;Minecraft&#x7A97;&#x4F53;&#x6807;&#x9898;&#x5728;<code>createDisplay</code>&#x65B9;&#x6CD5;&#x4E2D;&#x5B9A;&#x4E49;&#x3002;</p>
<ul>
<li><code>@Overwrite</code>&#xFF08;<a href="http://jenkins.liteloader.com/job/Mixin/javadoc/org/spongepowered/asm/mixin/Overwrite.html" target="_blank">&#x6587;&#x6863;</a>&#xFF09;<br>&#x76F8;&#x4FE1;&#x4F60;&#x770B;&#x5230;&#x6CE8;&#x89E3;&#x540D;&#x79F0;&#x5C31;&#x77E5;&#x9053;&#x8FD9;&#x4E2A;&#x6CE8;&#x89E3;&#x662F;&#x505A;&#x4EC0;&#x4E48;&#x7684;&#x4E86;&#x2014;&#x2014;&#x5141;&#x8BB8;&#x6CE8;&#x5165;&#x65B9;&#x6CD5;&#x91CD;&#x5199;&#x6574;&#x4E2A;&#x76EE;&#x6807;&#x65B9;&#x6CD5;&#x3002;<br>&#x5F88;&#x660E;&#x663E;&#xFF0C;&#x8FD9;&#x79CD;&#x4FEE;&#x6539;&#x65B9;&#x5F0F;&#x5F15;&#x8D77;&#x51B2;&#x7A81;&#x7684;&#x6982;&#x7387;&#x4E5F;&#x4F1A;&#x6BD4;&#x5176;&#x4ED6;&#x6CE8;&#x5165;&#x65B9;&#x5F0F;&#x9AD8;&#x5F88;&#x591A;&#xFF0C;&#x6240;&#x4EE5;Sponge&#x5EFA;&#x8BAE;&#x4E0D;&#x5230;&#x4E07;&#x4E0D;&#x5F97;&#x5DF2;&#xFF0C;&#x5C3D;&#x91CF;&#x4E0D;&#x8981;&#x4F7F;&#x7528;&#x5B83;&#xFF0C;&#x4EE5;&#x53CA;&#x5EFA;&#x8BAE;&#x4E3A;&#x8FD9;&#x4E9B;&#x6CE8;&#x5165;&#x65B9;&#x6CD5;&#x5199;&#x4E00;&#x4E2A;Javadoc&#xFF0C;&#x5426;&#x5219;&#x7F16;&#x8BD1;&#x65F6;&#x4F1A;&#x629B;&#x51FA;&#x4E00;&#x4E2A;&#x8B66;&#x544A;&#x3002;&#x4F46;&#x662F;&#x4F5C;&#x4E3A;&#x6559;&#x7A0B;&#xFF0C;&#x6211;&#x4EEC;&#x8FD8;&#x662F;&#x8981;&#x8BF4;&#x4E00;&#x8BF4;&#x8FD9;&#x4E2A;&#x8BE5;&#x600E;&#x4E48;&#x7528;&#x3002;<br>&#x88AB;&#x6B64;&#x6CE8;&#x89E3;&#x6807;&#x8BB0;&#x7684;&#x65B9;&#x6CD5;&#x7684;&#x8BBF;&#x95EE;&#x7EA7;&#x4E0D;&#x80FD;&#x4F4E;&#x4E8E;&#x76EE;&#x6807;&#x65B9;&#x6CD5;&#x7684;&#x8BBF;&#x95EE;&#x7EA7;&#xFF0C;&#x4F46;&#x662F;&#x6709;&#x4E00;&#x4E2A;&#x6CE8;&#x610F;&#x70B9;&#xFF1A;&#x5176;&#x4ED6;&#x6A21;&#x7EC4;&#x53EF;&#x80FD;&#x4F7F;&#x7528;FMLAT&#x7B49;&#x65B9;&#x5F0F;&#x4FEE;&#x6539;&#x76EE;&#x6807;&#x65B9;&#x6CD5;&#x7684;&#x8BBF;&#x95EE;&#x7EA7;&#xFF1B;&#x6CE8;&#x5165;&#x65B9;&#x6CD5;&#x7684;&#x65B9;&#x6CD5;&#x7B7E;&#x540D;&#x8981;&#x548C;&#x76EE;&#x6807;&#x65B9;&#x6CD5;&#x4E00;&#x81F4;&#x3002;</li>
</ul>
<p>&#x6240;&#x4EE5;&#x6211;&#x4EEC;&#x5927;&#x6982;&#x53EF;&#x4EE5;&#x8FD9;&#x4E48;&#x5199;&#xFF1A;</p>
<pre><code class="lang-java">    <span class="hljs-meta">@Overwrite</span>
    <span class="hljs-function"><span class="hljs-keyword">private</span> <span class="hljs-keyword">void</span> <span class="hljs-title">createDisplay</span><span class="hljs-params">()</span> <span class="hljs-keyword">throws</span> LWJGLException </span>{
        Display.setResizable(<span class="hljs-keyword">true</span>);
        Display.setTitle(<span class="hljs-string">&quot;MyCustomTitle&quot;</span>);
        <span class="hljs-keyword">try</span> {
            Display.create((<span class="hljs-keyword">new</span> PixelFormat()).withDepthBits(<span class="hljs-number">24</span>));
        } <span class="hljs-keyword">catch</span> (LWJGLException lwjglexception) {
            LOGGER.error(<span class="hljs-string">&quot;Couldn&apos;t set pixel format&quot;</span>, lwjglexception);
            <span class="hljs-keyword">try</span> {
                Thread.sleep(<span class="hljs-number">1000L</span>);
            } <span class="hljs-keyword">catch</span> (InterruptedException e) {}
            <span class="hljs-keyword">if</span> (<span class="hljs-keyword">this</span>.fullscreen) {
                <span class="hljs-keyword">this</span>.updateDisplayMode();
            }
            Display.create();
        }
    }
</code></pre>
<p>&#x4E14;&#x6162;&#xFF01;&#x6211;&#x4EEC;&#x5F15;&#x7528;&#x4E86;&#x51E0;&#x4E2A;&#x5728;<code>Minecraft</code>&#x4E2D;&#x7684;&#x79C1;&#x6709;&#x5B57;&#x6BB5;&#x548C;&#x65B9;&#x6CD5;&#xFF0C;&#x7136;&#x800C;&#x5728;<code>MixinMinecraft</code>&#x4E2D;&#x8FD9;&#x4E9B;&#x5B57;&#x6BB5;&#x548C;&#x65B9;&#x6CD5;&#x5E76;&#x4E0D;&#x5B58;&#x5728;&#xFF0C;&#x4F46;&#x662F;<code>MixinMinecraft</code>&#x6700;&#x540E;&#x662F;&#x8981;&#x5408;&#x5E76;&#x5230;<code>Minecraft</code>&#x4E2D;&#x53BB;&#x7684;&#xFF0C;&#x6240;&#x4EE5;&#x76F4;&#x63A5;&#x8BBF;&#x95EE;&#x8FD9;&#x4E9B;&#x5B57;&#x6BB5;&#x548C;&#x65B9;&#x6CD5;&#x672C;&#x5E94;&#x5F53;&#x662F;&#x5408;&#x6CD5;&#x7684;&#x3002;&#x597D;&#x5728;Mixin&#x7ED9;&#x6211;&#x4EEC;&#x63D0;&#x4F9B;&#x4E86;&#x4E00;&#x4E2A;&#x6CE8;&#x89E3;&#xFF0C;&#x7528;&#x4E8E;&#x6807;&#x8BB0;&#x672C;&#x5E94;&#x5B58;&#x5728;&#x4E8E;&#x76EE;&#x6807;&#x7C7B;&#x7684;&#x5B57;&#x6BB5;&#x548C;&#x65B9;&#x6CD5;&#xFF1A;</p>
<ul>
<li><code>@Shadow</code>&#xFF08;<a href="http://jenkins.liteloader.com/job/Mixin/javadoc/org/spongepowered/asm/mixin/Shadow.html" target="_blank">&#x6587;&#x6863;</a>&#xFF09;<br>&#x88AB;&#x8FD9;&#x4E2A;&#x6CE8;&#x89E3;&#x6807;&#x8BB0;&#x7684;&#x5B57;&#x6BB5;&#x7528;&#x4E8E;&#x6307;&#x793A;&#x90A3;&#x4E9B;&#x672C;&#x5E94;&#x5728;&#x76EE;&#x6807;&#x7C7B;&#x7684;&#x5B57;&#x6BB5;&#xFF0C;&#x5B83;&#x4EEC;&#x6700;&#x540E;&#x4E0D;&#x4F1A;&#x88AB;&#x5408;&#x5E76;&#x5230;&#x76EE;&#x6807;&#x7C7B;&#x4E2D;&#x53BB;&#x3002;&#x5982;&#x679C;&#x8981;&#x5F15;&#x7528;&#x76EE;&#x6807;&#x7C7B;&#x7236;&#x7C7B;&#x7684;&#x5B57;&#x6BB5;&#xFF0C;&#x53C2;&#x89C1;<a href="5.6.html">&#x878D;&#x5408;</a>&#x4E00;&#x7AE0;&#x7684;<code>&#x8BBF;&#x95EE;&#x76EE;&#x6807;&#x7C7B;&#x7236;&#x7C7B;&#x6210;&#x5458;</code>&#x3002;  </li>
</ul>
<p>&#x6240;&#x4EE5;&#x73B0;&#x5728;&#x5E94;&#x8BE5;&#x53D8;&#x6210;&#x8FD9;&#x6837;&#xFF1A;</p>
<pre><code class="lang-java"><span class="hljs-keyword">package</span> com.example.mixins;

<span class="hljs-keyword">import</span> net.minecraft.client.Minecraft;
<span class="hljs-keyword">import</span> org.apache.logging.log4j.Logger;
<span class="hljs-keyword">import</span> org.lwjgl.LWJGLException;
<span class="hljs-keyword">import</span> org.lwjgl.opengl.Display;
<span class="hljs-keyword">import</span> org.lwjgl.opengl.PixelFormat;
<span class="hljs-keyword">import</span> org.spongepowered.asm.mixin.Mixin;
<span class="hljs-keyword">import</span> org.spongepowered.asm.mixin.Overwrite;
<span class="hljs-keyword">import</span> org.spongepowered.asm.mixin.Shadow;

<span class="hljs-meta">@Mixin</span>(Minecraft.class)
<span class="hljs-keyword">public</span> <span class="hljs-keyword">abstract</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MixinMinecraft</span> </span>{
    <span class="hljs-meta">@Shadow</span>
    <span class="hljs-keyword">private</span> <span class="hljs-keyword">static</span> Logger LOGGER; <span class="hljs-comment">// &#x6211;&#x4EEC;&#x4E0D;&#x5FC5;&#x7ED9;Shadow&#x5B57;&#x6BB5;&#x8D4B;&#x503C;</span>
    <span class="hljs-meta">@Shadow</span>
    <span class="hljs-keyword">private</span> <span class="hljs-keyword">boolean</span> fullscreen;

    <span class="hljs-meta">@Overwrite</span>
    <span class="hljs-function"><span class="hljs-keyword">private</span> <span class="hljs-keyword">void</span> <span class="hljs-title">createDisplay</span><span class="hljs-params">()</span> <span class="hljs-keyword">throws</span> LWJGLException </span>{
        Display.setResizable(<span class="hljs-keyword">true</span>);
        Display.setTitle(<span class="hljs-string">&quot;MyCustomTitle&quot;</span>);
        <span class="hljs-keyword">try</span> {
            Display.create((<span class="hljs-keyword">new</span> PixelFormat()).withDepthBits(<span class="hljs-number">24</span>));
        } <span class="hljs-keyword">catch</span> (LWJGLException lwjglexception) {
            LOGGER.error(<span class="hljs-string">&quot;Couldn&apos;t set pixel format&quot;</span>, lwjglexception);
            <span class="hljs-keyword">try</span> {
                Thread.sleep(<span class="hljs-number">1000L</span>);
            } <span class="hljs-keyword">catch</span> (InterruptedException e) {}
            <span class="hljs-keyword">if</span> (<span class="hljs-keyword">this</span>.fullscreen) {
                <span class="hljs-keyword">this</span>.updateDisplayMode();
            }
            Display.create();
        }
    }

    <span class="hljs-meta">@Shadow</span>
    <span class="hljs-function"><span class="hljs-keyword">protected</span> <span class="hljs-keyword">abstract</span> <span class="hljs-keyword">void</span> <span class="hljs-title">updateDisplayMode</span><span class="hljs-params">()</span></span>;
    <span class="hljs-comment">// &#x8FD9;&#x5C31;&#x662F;&#x4E3A;&#x4EC0;&#x4E48;&#x5EFA;&#x8BAE;&#x8BA9;&#x6CE8;&#x5165;&#x7C7B;&#x8BBE;&#x4E3A;&#x62BD;&#x8C61;&#x7C7B;&#x7684;&#x539F;&#x56E0;&#x4E4B;&#x4E00;&#x4E86;&#x2014;&#x2014;&#x4E0D;&#x5FC5;&#x5B9E;&#x73B0;&#x6574;&#x4E2A;&#x65B9;&#x6CD5;</span>
    <span class="hljs-comment">// &#x4F46;&#x662F;&#x62BD;&#x8C61;&#x65B9;&#x6CD5;&#x7684;&#x8BBF;&#x95EE;&#x7EA7;&#x6700;&#x4F4E;&#x53EA;&#x80FD;&#x662F;protected&#x3002;</span>
}
</code></pre>
<p>&#x4F46;&#x662F;&#x6211;&#x4EEC;&#x6CE8;&#x610F;&#x5230;&#x539F;&#x672C;<code>LOGGER</code>&#x5B57;&#x6BB5;&#x662F;<code>final</code>&#x7684;&#xFF0C;&#x4F46;&#x662F;&#x6211;&#x4EEC;&#x6CA1;&#x6709;&#x7ED9;&#x5B83;&#x8D4B;&#x503C;&#xFF0C;&#x6240;&#x4EE5;&#x4E0D;&#x80FD;&#x76F4;&#x63A5;&#x52A0;<code>final</code>&#x5173;&#x952E;&#x8BCD;&#xFF0C;&#x56E0;&#x6B64;&#x4E3A;&#x4E86;&#x907F;&#x514D;&#x6211;&#x4EEC;&#x4E0D;&#x5C0F;&#x5FC3;&#x4FEE;&#x6539;&#x4E86;&#x5B83;&#xFF0C;Mixin&#x63D0;&#x4F9B;&#x4E86;&#x53E6;&#x5916;&#x4E00;&#x4E2A;&#x6CE8;&#x89E3;&#xFF1A;</p>
<ul>
<li><code>@Final</code>&#xFF08;<a href="http://jenkins.liteloader.com/job/Mixin/javadoc/org/spongepowered/asm/mixin/Final.html" target="_blank">&#x6587;&#x6863;</a>&#xFF09;<br>&#x8FD9;&#x4E2A;&#x6CE8;&#x89E3;&#x5FC5;&#x987B;&#x6807;&#x8BB0;&#x5728;&#x5DF2;&#x88AB;<code>@Shadow</code>&#x6807;&#x8BB0;&#x7684;&#x5B57;&#x6BB5;&#x6216;&#x65B9;&#x6CD5;&#x4E0A;&#xFF0C;&#x5E76;&#x4E14;&#x8FD9;&#x4E2A;&#x5B57;&#x6BB5;&#x6216;&#x65B9;&#x6CD5;&#x539F;&#x672C;&#x5728;&#x76EE;&#x6807;&#x7C7B;&#x4E2D;&#x5FC5;&#x987B;&#x88AB;<code>final</code>&#x4FEE;&#x9970;&#xFF0C;&#x5982;&#x679C;&#x5728;&#x7A0B;&#x5E8F;&#x4E2D;&#x4FEE;&#x6539;&#x4E86;&#x88AB;&#x6B64;&#x6CE8;&#x89E3;&#x6807;&#x8BB0;&#x7684;&#x5B57;&#x6BB5;&#xFF0C;&#x90A3;&#x4E48;&#x7F16;&#x8BD1;&#x65F6;&#x4F1A;&#x629B;&#x51FA;&#x4E00;&#x4E2A;&#x9519;&#x8BEF;&#x3002;</li>
</ul>
<p>&#x6240;&#x4EE5;&#x73B0;&#x5728;&#x6211;&#x4EEC;&#x5E94;&#x8BE5;&#x8FD9;&#x6837;&#xFF1A;</p>
<pre><code class="lang-java">    <span class="hljs-meta">@Final</span>
    <span class="hljs-meta">@Shadow</span>
    <span class="hljs-keyword">private</span> <span class="hljs-keyword">static</span> Logger LOGGER;
</code></pre>
<p>&#x5982;&#x679C;&#x4F60;&#x60F3;&#x8981;&#x523B;&#x610F;&#x5730;&#x4FEE;&#x6539;&#x4E00;&#x4E2A;final&#x6210;&#x5458;&#xFF0C;&#x8BF7;&#x5728;<code>@Final</code>&#x6CE8;&#x89E3;&#x4E4B;&#x540E;&#x518D;&#x6DFB;&#x52A0;&#x4E0B;&#x9762;&#x8FD9;&#x4E2A;&#x6CE8;&#x89E3;&#xFF1A;</p>
<ul>
<li><code>@Mutable</code>&#xFF08;<a href="http://jenkins.liteloader.com/job/Mixin/javadoc/org/spongepowered/asm/mixin/Mutable.html" target="_blank">&#x6587;&#x6863;</a>&#xFF09;<br>&#x7528;&#x4E8E;&#x6807;&#x8BB0;&#x4E00;&#x4E2A;&#x88AB;<code>@Final</code>&#x6807;&#x8BB0;&#x7684;&#x6210;&#x5458;&#xFF0C;&#x8868;&#x660E;&#x8FD9;&#x4E2A;&#x6210;&#x5458;&#x53EF;&#x4EE5;&#x88AB;&#x4FEE;&#x6539;&#x3002;</li>
</ul>
<p>&#x73B0;&#x5728;&#x8FD8;&#x6709;&#x4E00;&#x4E2A;&#x95EE;&#x9898;&#xFF0C;&#x4E3E;&#x4E2A;&#x4F8B;&#x5B50;&#xFF1A;<br>&#x2003;&#x2003;&#x67E5;&#x9605;MCP&#x6620;&#x5C04;&#x8868;&#xFF0C;&#x6211;&#x4EEC;&#x4F1A;&#x53D1;&#x73B0;<code>NetworkPlayerInfo$1</code>&#x4E0B;&#x6709;&#x4E00;&#x4E2A;&#x540D;&#x4E3A;<code>field_177224_a</code>&#x7684;&#x5B57;&#x6BB5;&#xFF0C;&#x4F46;&#x662F;&#x6211;&#x4EEC;&#x67E5;&#x627E;&#x5F00;&#x53D1;&#x73AF;&#x5883;&#x4E2D;&#x7684;Minecraft&#x4EE3;&#x7801;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x662F;&#x627E;&#x4E0D;&#x5230;&#x8FD9;&#x4E2A;<code>field_177224_a</code>&#x7684;&#x3002;&#x90A3;&#x4E48;&#x8FD9;&#x4E2A;&#x5B57;&#x6BB5;&#x662F;&#x4EC0;&#x4E48;&#x5462;&#xFF1F;<br>&#x2003;&#x2003;&#x5982;&#x679C;&#x6211;&#x4EEC;&#x60F3;&#x8981;&#x5728;<code>MixinNetworkPlayerInfo$1</code>&#x4E2D;&#x50CF;<code>NetworkPlayerInfo$1.skinAvailable</code>&#x65B9;&#x6CD5;&#x4E2D;&#x5F15;&#x7528;<code>NetworkPlayerInfo.this.playerTextures</code>&#x7684;&#x8BDD;&#xFF0C;&#x4F60;&#x4F1A;&#x53D1;&#x73B0;&#x6839;&#x672C;&#x5F15;&#x7528;&#x4E0D;&#x4E86;&#xFF01;&#x8FD9;&#x5C31;&#x89E3;&#x91CA;&#x4E86;<code>field_177224_a</code>&#x662F;&#x4EC0;&#x4E48;&#x4E86;&#xFF1A;&#x662F;&#x5B58;&#x653E;<code>NetworkPlayerInfo</code>&#x5B9E;&#x4F8B;&#x7684;&#x5B57;&#x6BB5;&#xFF0C;&#x8FD9;&#x662F;&#x4E00;&#x4E2A;<code>synthetic</code>&#x5B57;&#x6BB5;&#x3002;<br>&#x2003;&#x2003;&#x5728;Java&#x4E2D;&#xFF0C;&#x5BF9;&#x4E8E;&#x5185;&#x90E8;&#x7C7B;&#x800C;&#x8A00;&#xFF0C;&#x4E00;&#x5B9A;&#x4F1A;&#x6709;&#x4E00;&#x4E2A;&#x5B57;&#x6BB5;&#x7528;&#x4E8E;&#x5B58;&#x653E;&#x5916;&#x90E8;&#x7C7B;&#x5B9E;&#x4F8B;&#xFF0C;&#x5E76;&#x4E14;&#x5185;&#x90E8;&#x7C7B;&#x7684;&#x6784;&#x9020;&#x65B9;&#x6CD5;&#x7684;&#x7B2C;&#x4E00;&#x4E2A;&#x53C2;&#x6570;&#x4E00;&#x5B9A;&#x662F;&#x7528;&#x4E8E;&#x521D;&#x59CB;&#x5316;&#x8FD9;&#x4E2A;&#x5B57;&#x6BB5;&#x7684;&#xFF0C;&#x8FD9;&#x6837;&#x5F15;&#x7528;<code>&#x5916;&#x90E8;&#x7C7B;.this</code>&#x7684;&#x65F6;&#x5019;&#x5BF9;&#x4E8E;JVM&#x800C;&#x8A00;&#x76F8;&#x5F53;&#x4E8E;&#x5728;&#x5F15;&#x7528;&#x8FD9;&#x4E2A;<code>synthetic</code>&#x5B57;&#x6BB5;&#x3002;<br>&#x2003;&#x2003;&#x8FD9;&#x4E2A;&#x5916;&#x90E8;&#x7C7B;&#x5B9E;&#x4F8B;&#x5B57;&#x6BB5;&#x4E00;&#x822C;&#x540D;&#x79F0;&#x90FD;&#x53EB;<code>this$0</code>&#xFF08;&#x4F60;&#x53EF;&#x80FD;&#x9700;&#x8981;&#x501F;&#x52A9;<code>ByteCodeOutline</code>&#x4E4B;&#x7C7B;&#x7684;&#x63D2;&#x4EF6;&#x770B;&#x4E00;&#x770B;&#x5177;&#x4F53;&#x53EB;&#x4EC0;&#x4E48;&#xFF09;&#xFF0C;&#x4F46;&#x662F;Minecraft&#x672C;&#x8EAB;&#x662F;&#x505A;&#x8FC7;&#x6DF7;&#x6DC6;&#x7684;&#xFF0C;&#x4F1A;&#x628A;<code>this$0</code>&#x6DF7;&#x6DC6;&#x6210;&#x4E00;&#x4E9B;&#x6BEB;&#x65E0;&#x610F;&#x4E49;&#x7684;&#x5B57;&#x7B26;&#xFF0C;MCP&#x53CD;&#x6DF7;&#x6DC6;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x4F1A;&#x7ED9;&#x5B83;&#x8D4B;&#x4E88;&#x4E00;&#x4E2A;<code>searge name</code>&#xFF0C;&#x800C;&#x5230;&#x4E86;&#x5F00;&#x53D1;&#x73AF;&#x5883;&#x4E2D;&#xFF0C;&#x5B83;&#x5C31;&#x4F1A;&#x53D8;&#x6210;<code>this$0</code>&#xFF0C;&#x4E0D;&#x540C;&#x4E8E;&#x5176;&#x4ED6;&#x7684;&#x5B57;&#x6BB5;&#xFF0C;<code>field_177224_a -&gt; this$0</code>&#x8FD9;&#x4E2A;&#x6620;&#x5C04;&#x5E76;&#x4E0D;&#x5B58;&#x5728;&#x4E8E;&#x6620;&#x5C04;&#x8868;&#x4E2D;&#xFF0C;&#x800C;&#x4E14;&#x5B83;&#x5728;&#x5F00;&#x53D1;&#x73AF;&#x5883;&#x4E2D;&#x4E5F;&#x5E76;&#x4E0D;&#x663E;&#x5F0F;&#x5730;&#x5B58;&#x5728;&#xFF0C;&#x6240;&#x4EE5;&#x7F16;&#x8BD1;&#x65F6;Mixin&#x5C31;&#x4F1A;&#x65E0;&#x4ECE;&#x4E0B;&#x624B;&#x3002;&#x5982;&#x679C;&#x6211;&#x4EEC;&#x76F4;&#x63A5;&#x7528;<code>@Shadow</code>&#x5F15;&#x7528;&#x5B83;&#xFF0C;&#x65E0;&#x8BBA;&#x4E0B;&#x9762;&#x54EA;&#x79CD;&#x65B9;&#x5F0F;&#xFF0C;&#x90FD;&#x4F1A;&#x62A5;&#x9519;&#xFF1A;</p>
<pre><code class="lang-java"><span class="hljs-meta">@Mixin</span>(targets = <span class="hljs-string">&quot;net.minecraft.client.network.NetworkPlayerInfo$1&quot;</span>)
<span class="hljs-keyword">public</span> <span class="hljs-keyword">abstract</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MixinNetworkPlayerInfo</span>$1 </span>{
    <span class="hljs-meta">@Shadow</span>
    <span class="hljs-keyword">private</span> NetworkPlayerInfo field_177224_a;
}

<span class="hljs-meta">@Mixin</span>(targets = <span class="hljs-string">&quot;net.minecraft.client.network.NetworkPlayerInfo$1&quot;</span>)
<span class="hljs-keyword">public</span> <span class="hljs-keyword">abstract</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MixinNetworkPlayerInfo</span>$1 </span>{
    <span class="hljs-meta">@Shadow</span>
    <span class="hljs-keyword">private</span> NetworkPlayerInfo <span class="hljs-keyword">this</span>$<span class="hljs-number">0</span>;
}
</code></pre>
<p>&#x8FD9;&#x65F6;&#x5019;&#xFF0C;<code>@Shadow</code>&#x4E2D;&#x7684;<code>aliases</code>&#x5C5E;&#x6027;&#x5C31;&#x6D3E;&#x4E0A;&#x7528;&#x573A;&#x4E86;&#xFF0C;&#x7528;&#x4E8E;&#x6307;&#x5B9A;&#x4E00;&#x4E2A;&#x5408;&#x6210;&#x6210;&#x5458;&#x7684;&#x540D;&#x79F0;&#xFF0C;&#x4E0D;&#x8FC7;&#x8FD9;&#x4E2A;&#x5B57;&#x6BB5;&#x540D;&#x8FD8;&#x662F;&#x5F97;&#x5199;&#x6210;&#x5BF9;&#x5E94;<code>searge name</code>&#xFF0C;&#x56E0;&#x4E3A;&#x751F;&#x4EA7;&#x73AF;&#x5883;&#x4E0B;&#x5E76;&#x6CA1;&#x6709;<code>this$0</code>&#x8FD9;&#x79CD;&#x4E1C;&#x897F;&#xFF1A;</p>
<pre><code class="lang-java"><span class="hljs-meta">@Mixin</span>(targets = <span class="hljs-string">&quot;net.minecraft.client.network.NetworkPlayerInfo$1&quot;</span>)
<span class="hljs-keyword">public</span> <span class="hljs-keyword">abstract</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MixinNetworkPlayerInfo</span>$1 </span>{
    <span class="hljs-meta">@Shadow</span>(aliases = <span class="hljs-string">&quot;this$0&quot;</span>)
    <span class="hljs-keyword">private</span> NetworkPlayerInfo field_177224_a;
}
</code></pre>
<p>&#x8FD9;&#x5BF9;&#x4E8E;<code>@Overwrite</code>&#x4E2D;&#x7684;<code>aliases</code>&#x89E3;&#x91CA;&#x662F;&#x4E00;&#x81F4;&#x7684;&#x3002;
&#x5F53;&#x7136;&#x4E86;&#xFF0C;&#x4E0D;&#x4EC5;&#x4EC5;&#x662F;<code>this$0</code>&#xFF0C;&#x5728;&#x5176;&#x4ED6;&#x5F88;&#x591A;&#x573A;&#x5408;&#x90FD;&#x4F1A;&#x51FA;&#x73B0;&#x5408;&#x6210;&#x6210;&#x5458;&#xFF0C;&#x6BD4;&#x5982;&#x65B9;&#x6CD5;&#x4F53;&#x5185;&#x7684;&#x5185;&#x90E8;&#x7C7B;&#x53EF;&#x4EE5;&#x5F15;&#x7528;&#x65B9;&#x6CD5;&#x4F53;&#x5185;&#x7684;&#x5C40;&#x90E8;&#x53D8;&#x91CF;&#xFF0C;&#x8FD9;&#x4E9B;&#x5C40;&#x90E8;&#x53D8;&#x91CF;&#x4E5F;&#x4F1A;&#x5728;&#x5185;&#x90E8;&#x7C7B;&#x4E2D;&#x4EA7;&#x751F;&#x5408;&#x6210;&#x6210;&#x5458;&#x3002;</p>
<p>&#x597D;&#x4E86;&#xFF0C;&#x5F88;&#x660E;&#x663E;&#xFF0C;&#x7528;<code>@Overwrite</code>&#x6709;&#x9AD8;&#x5C04;&#x70AE;&#x6253;&#x868A;&#x5B50;&#x7684;&#x611F;&#x89C9;&#xFF0C;&#x6211;&#x4EEC;&#x53EA;&#x662F;&#x4FEE;&#x6539;&#x4E00;&#x4E2A;&#x6807;&#x9898;&#x8BF6;&#xFF01;<br>&#x6240;&#x4EE5;Mixin&#x63D0;&#x4F9B;&#x4E86;&#x5F88;&#x591A;&#x4E30;&#x5BCC;&#x591A;&#x6837;&#x7684;&#x6CE8;&#x89E3;&#xFF0C;&#x5E94;&#x7528;&#x4E8E;&#x5404;&#x79CD;&#x59FF;&#x52BF;&#x4FEE;&#x6539;&#x65B9;&#x6CD5;&#x4F53;&#x5185;&#x7684;&#x5B57;&#x8282;&#x7801;&#x3002;  </p>
<p>&#x73B0;&#x5728;&#x6211;&#x4EEC;&#x8003;&#x8651;&#x4E00;&#x4E0B;&#x8FD8;&#x6709;&#x54EA;&#x4E9B;&#x53EF;&#x884C;&#x7684;&#x4FEE;&#x6539;&#x65B9;&#x6848;&#x53EF;&#x4EE5;&#x8FBE;&#x5230;&#x4FEE;&#x6539;&#x6807;&#x9898;&#x7684;&#x76EE;&#x7684;&#xFF1A;</p>
<ul>
<li><p>&#x53EF;&#x4EE5;&#x5728;<code>setTitle</code>&#x4E4B;&#x540E;&#x518D;&#x91CD;&#x65B0;&#x8BBE;&#x7F6E;&#x4E00;&#x6B21;&#x6807;&#x9898;&#xFF1A;</p>
<pre><code class="lang-java">  <span class="hljs-function"><span class="hljs-keyword">private</span> <span class="hljs-keyword">void</span> <span class="hljs-title">createDisplay</span><span class="hljs-params">()</span> <span class="hljs-keyword">throws</span> LWJGLException </span>{
      Display.setResizable(<span class="hljs-keyword">true</span>);
      Display.setTitle(<span class="hljs-string">&quot;Minecraft 1.12.2&quot;</span>);
      <span class="hljs-keyword">this</span>.mixinMethod(); <span class="hljs-comment">// &lt;--&#x6CE8;&#x610F;&#x770B;&#x8FD9;&#x91CC;</span>
      <span class="hljs-keyword">try</span> {
          Display.create((<span class="hljs-keyword">new</span> PixelFormat()).withDepthBits(<span class="hljs-number">24</span>));
      } <span class="hljs-keyword">catch</span> (LWJGLException lwjglexception) {
          LOGGER.error(<span class="hljs-string">&quot;Couldn&apos;t set pixel format&quot;</span>, lwjglexception);
          <span class="hljs-keyword">try</span> {
              Thread.sleep(<span class="hljs-number">1000L</span>);
          } <span class="hljs-keyword">catch</span> (InterruptedException e) {}
          <span class="hljs-keyword">if</span> (<span class="hljs-keyword">this</span>.fullscreen) {
              <span class="hljs-keyword">this</span>.updateDisplayMode();
          }
          Display.create();
      }
  }

  <span class="hljs-function"><span class="hljs-keyword">private</span> <span class="hljs-keyword">void</span> <span class="hljs-title">mixinMethod</span><span class="hljs-params">()</span> </span>{
      Display.setTitle(<span class="hljs-string">&quot;MyCustomTitle&quot;</span>);
  }
</code></pre>
<p>  &#x9488;&#x5BF9;&#x8FD9;&#x79CD;&#x4FEE;&#x6539;&#x65B9;&#x5F0F;&#xFF0C;Mixin&#x63D0;&#x4F9B;&#x4E86;&#x4E0B;&#x9762;&#x8FD9;&#x4E2A;&#x6CE8;&#x89E3;&#xFF1A;</p>
<ul>
<li><code>@Inject</code>&#xFF08;<a href="http://jenkins.liteloader.com/job/Mixin/javadoc/org/spongepowered/asm/mixin/injection/Inject.html" target="_blank">&#x6587;&#x6863;</a>&#xFF09;<br>&#x5173;&#x4E8E;&#x8FD9;&#x4E2A;&#x6CE8;&#x89E3;&#x7684;Wiki&#xFF1A; <a href="https://github.com/SpongePowered/Mixin/wiki/Advanced-Mixin-Usage---Callback-Injectors" target="_blank">Advanced Mixin Usage Callback Injectors</a> &#x3002;<br>&#x8FD9;&#x4E2A;&#x6CE8;&#x89E3;&#x5141;&#x8BB8;&#x6A21;&#x7EC4;&#x5728;&#x76EE;&#x6807;&#x65B9;&#x6CD5;&#x4F53;&#x5185;&#x5408;&#x9002;&#x7684;&#x4F4D;&#x7F6E;&#x6DFB;&#x52A0;&#x5BF9;&#x81EA;&#x5DF1;&#x6307;&#x5B9A;&#x7684;&#x65B9;&#x6CD5;&#x8C03;&#x7528;&#x3002;<br>&#x6211;&#x4EEC;&#x73B0;&#x5728;&#x5C31;&#x6709;&#x53EF;&#x80FD;&#x7528;&#x5230;&#x7684;&#x51E0;&#x4E2A;&#x5C5E;&#x6027;&#xFF1A;<ul>
<li><code>id</code>: &#x6307;&#x5B9A;&#x6B64;&#x6CE8;&#x89E3;&#x7684;&#x8BC6;&#x522B;&#x540D;&#x79F0;&#xFF0C;&#x4E0D;&#x8BBE;&#x7F6E;&#x5219;&#x9ED8;&#x8BA4;&#x4E3A;&#x6CE8;&#x5165;&#x7684;&#x76EE;&#x6807;&#x65B9;&#x6CD5;&#xFF08;&#x6CE8;&#x5165;&#x5931;&#x8D25;&#x65F6;&#x4F1A;&#x5728;&#x65E5;&#x5FD7;&#x4E2D;&#x663E;&#x793A;&#xFF09;</li>
<li><code>method</code>: &#x7528;&#x4E8E;&#x6307;&#x5B9A;&#x6CE8;&#x5165;&#x7684;&#x4E00;&#x4E2A;&#x6216;&#x591A;&#x4E2A;&#x76EE;&#x6807;&#x65B9;&#x6CD5;&#xFF0C;&#x4EE5;&#x4E0B;&#x51E0;&#x79CD;&#x5199;&#x6CD5;&#x90FD;&#x662F;&#x5408;&#x6CD5;&#x7684;&#xFF1A;  <ul>
<li><code>createDisplay</code></li>
<li><code>createDisplay()V</code></li>
<li><code>net.minecraft.client.Minecraft.createDisplay</code></li>
<li><code>net/minecraft/client/Minecraft.createDisplay</code></li>
<li><code>Lnet/minecraft/client/Minecraft;createDisplay</code></li>
<li><code>net.minecraft.client.Minecraft.createDisplay()V</code></li>
<li><code>net/minecraft/client/Minecraft.createDisplay()V</code></li>
<li><code>Lnet/minecraft/client/Minecraft;createDisplay()V</code><br>&#x9700;&#x8981;&#x6CE8;&#x610F;&#x7684;&#x662F;&#xFF1A;&#x5982;&#x679C;&#x4E00;&#x4E2A;&#x7C7B;&#x4E2D;&#x542B;&#x6709;&#x591A;&#x4E2A;&#x540C;&#x540D;&#x65B9;&#x6CD5;&#xFF0C;&#x800C;&#x4F60;&#x6CA1;&#x6709;&#x6307;&#x5B9A;&#x6CE8;&#x5165;&#x7684;&#x65B9;&#x6CD5;&#x7B7E;&#x540D;&#xFF0C;&#x90A3;&#x4E48;Mixin&#x5C31;&#x4F1A;&#x53EA;&#x6CE8;&#x5165;&#x5339;&#x914D;&#x5230;&#x7684;&#x7B2C;&#x4E00;&#x4E2A;&#x65B9;&#x6CD5;&#x3002;&#x5982;&#x679C;&#x4F60;&#x60F3;&#x6CE8;&#x5165;&#x6BCF;&#x4E2A;&#x540C;&#x540D;&#x65B9;&#x6CD5;&#xFF0C;&#x53EF;&#x4EE5;&#x7528;&#x4E0B;&#x9762;&#x8FD9;&#x79CD;&#x5199;&#x6CD5;&#xFF1A;</li>
<li><code>createDisplay*</code> : &#xFF08;&#x5176;&#x5B9E;&#x5C31;&#x662F;&#x540D;&#x79F0;&#x672B;&#x5C3E;&#x52A0;&#x4E2A;<code>*</code>&#xFF09;</li>
</ul>
</li>
<li><code>slice</code>: &#x6307;&#x5B9A;&#x4E00;&#x4E2A;&#x6216;&#x591A;&#x4E2A;<code>@Slice</code>&#x6CE8;&#x89E3;&#xFF0C;&#x7528;&#x4E8E;&#x6307;&#x5B9A;&#x6CE8;&#x5165;&#x4F4D;&#x7F6E;&#x7684;&#x5B58;&#x5728;&#x8303;&#x56F4;</li>
<li><code>at</code>: &#x6307;&#x5B9A;&#x4E00;&#x4E2A;&#x6216;&#x591A;&#x4E2A;<code>@At</code>&#x6CE8;&#x89E3;&#xFF0C;&#x7528;&#x4E8E;&#x6307;&#x5B9A;&#x6CE8;&#x5165;&#x7684;&#x4F4D;&#x7F6E;</li>
<li><code>cancellable</code>: &#x51B3;&#x5B9A;&#x76EE;&#x6807;&#x65B9;&#x6CD5;&#x8C03;&#x7528;&#x5B8C;&#x6CE8;&#x5165;&#x65B9;&#x6CD5;&#x540E;&#x662F;&#x5426;&#x53D6;&#x6D88;&#x8FD0;&#x884C;&#x63A5;&#x4E0B;&#x6765;&#x7684;&#x90E8;&#x5206;&#x5E76;&#x76F4;&#x63A5;&#x8FD4;&#x56DE;&#xFF08;&#x8BBE;&#x7F6E;&#x4E3A;<code>true</code>&#x4E4B;&#x540E;&#x9700;&#x8981;&#x5728;&#x6CE8;&#x5165;&#x65B9;&#x6CD5;&#x4E2D;&#x624B;&#x52A8;&#x8C03;&#x7528;cancel&#x65B9;&#x6CD5;&#xFF09;</li>
<li><code>require</code>: &#x6307;&#x793A;&#x5339;&#x914D;&#x6B21;&#x6570;&#x6700;&#x5C11;&#x5E94;&#x8BE5;&#x6709;&#x591A;&#x5C11;&#x6B21;&#xFF08;&#x8FD0;&#x884C;&#x65F6;&#x5C11;&#x4E8E;&#x8FD9;&#x4E2A;&#x6B21;&#x6570;&#x4F1A;&#x629B;&#x51FA;&#x5F02;&#x5E38;&#xFF09;</li>
<li><code>allow</code>: &#x6307;&#x793A;&#x5339;&#x914D;&#x6B21;&#x6570;&#x6700;&#x591A;&#x5E94;&#x8BE5;&#x6709;&#x591A;&#x5C11;&#x6B21;&#xFF08;&#x8BBE;&#x7F6E;&#x5F97;&#x6BD4;<code>require</code>&#x5C0F;&#x6216;&#x8005;&#x5C0F;&#x4E8E;1&#x5219;&#x4F1A;&#x5FFD;&#x7565;&#xFF0C;&#x8FD0;&#x884C;&#x65F6;&#x591A;&#x4E8E;&#x8FD9;&#x4E2A;&#x6B21;&#x6570;&#x4F1A;&#x629B;&#x51FA;&#x5F02;&#x5E38;&#xFF09;</li>
</ul>
</li>
<li><code>@At</code>&#xFF08;<a href="http://jenkins.liteloader.com/job/Mixin/javadoc/org/spongepowered/asm/mixin/injection/At.html" target="_blank">&#x6587;&#x6863;</a>&#xFF09;<br>&#x5728;&#x7EE7;&#x7EED;&#x8BF4;&#x660E;<code>@Inject</code>&#x6CE8;&#x89E3;&#x4E4B;&#x524D;&#xFF0C;&#x6709;&#x5FC5;&#x8981;&#x8BF4;&#x660E;<code>@At</code>&#x6CE8;&#x89E3;&#x7684;&#x7528;&#x6CD5;&#x3002;<br>&#x6B64;&#x6CE8;&#x89E3;&#x6709;&#x4EE5;&#x4E0B;&#x51E0;&#x4E2A;&#x6BD4;&#x8F83;&#x91CD;&#x8981;&#x7684;&#x5C5E;&#x6027;&#xFF1A;<ul>
<li><code>value</code>: &#x8FD9;&#x4E2A;&#x5C5E;&#x6027;&#x7684;&#x503C;&#x51B3;&#x5B9A;&#x4E86;<code>args</code>&#x3001;<code>target</code>&#x3001;<code>ordinal</code>&#x3001;<code>opcode</code>&#x80FD;&#x586B;&#x54EA;&#x4E9B;&#x5185;&#x5BB9;<br>Wiki&#x4E2D;&#x5DF2;&#x7ECF;&#x8BB2;&#x5F97;&#x6BD4;&#x8F83;&#x8BE6;&#x7EC6;&#x4E86;&#xFF1A; <a href="https://github.com/SpongePowered/Mixin/wiki/Injection-Point-Reference" target="_blank">Injection Point Reference</a><br>&#x6216;&#x8005;&#x53C2;&#x8003;<a href="5.5.html">Mixin&#x5B9A;&#x4F4D;</a></li>
<li><code>slice</code>: &#x9009;&#x62E9;&#x4E00;&#x4E2A;&#x5728;&#x5916;&#x90E8;&#x6CE8;&#x89E3;&#x4E2D;&#x5B9A;&#x4E49;&#x7684;<code>@Slice</code>&#x6CE8;&#x89E3;&#x7684;id&#xFF08;&#x56E0;&#x4E3A;&#x6BD4;&#x5982;<code>@Inject</code>&#x6CE8;&#x89E3;&#x4E2D;&#x7684;<code>at</code>&#x548C;<code>slice</code>&#x5C5E;&#x6027;&#x90FD;&#x662F;&#x6570;&#x7EC4;&#xFF0C;&#x53EF;&#x4EE5;&#x6307;&#x5B9A;&#x591A;&#x4E2A;<code>@At</code>&#x548C;&#x591A;&#x4E2A;<code>@Slice</code>&#xFF0C;&#x6240;&#x4EE5;&#x8FD9;&#x4E2A;&#x65F6;&#x5019;&#x6307;&#x5B9A;&#x54EA;&#x4E2A;<code>@At</code>&#x5E94;&#x7528;&#x54EA;&#x4E2A;<code>@Slice</code>&#x5C31;&#x5F88;&#x6709;&#x5FC5;&#x8981;&#x4E86;&#xFF09;</li>
<li><code>shift</code>: &#x51B3;&#x5B9A;&#x6CE8;&#x5165;&#x4F4D;&#x7F6E;&#x76F8;&#x5BF9;&#x4E8E;&#x5339;&#x914D;&#x5230;&#x7684;&#x4F4D;&#x7F6E;&#x5411;&#x524D;&#x6216;&#x5411;&#x540E;&#x79FB;&#x52A8;</li>
<li><code>by</code>: &#x5F53;<code>shift</code>&#x5C5E;&#x6027;&#x8BBE;&#x7F6E;&#x4E3A;<code>At.Shift.BY</code>&#x65F6;&#xFF0C;&#x8BBE;&#x7F6E;&#x76F8;&#x5BF9;&#x79FB;&#x52A8;&#x7684;&#x683C;&#x6570;&#xFF08;&#x5141;&#x8BB8;&#x8BBE;&#x7F6E;&#x4E3A;&#x8D1F;&#x6570;&#xFF0C;&#x5982;&#x679C;&#x7EDD;&#x5BF9;&#x503C;&#x5927;&#x4E8E;3&#xFF0C;&#x90A3;&#x4E48;&#x5E94;&#x8BE5;&#x8003;&#x8651;&#x6362;&#x4E2A;&#x5339;&#x914D;&#x89C4;&#x5219;&#xFF09;</li>
</ul>
</li>
<li><p><code>@Slice</code>&#xFF08;<a href="http://jenkins.liteloader.com/job/Mixin/javadoc/org/spongepowered/asm/mixin/injection/Slice.html" target="_blank">&#x6587;&#x6863;</a>&#xFF09;  </p>
<ul>
<li><code>id</code>: &#x6307;&#x5B9A;&#x6B64;&#x6CE8;&#x89E3;&#x7684;&#x8BC6;&#x522B;&#x540D;&#x79F0;&#xFF08;&#x7ED9;<code>@At</code>&#x8BC6;&#x522B;&#x7528;&#x7684;&#xFF09;</li>
<li><code>from</code>: &#x7528;<code>@At</code>&#x5339;&#x914D;&#x8303;&#x56F4;&#x4ECE;&#x54EA;&#x5F00;&#x59CB;</li>
<li><code>to</code>: &#x5230;&#x54EA;&#x7ED3;&#x675F;</li>
</ul>
<p>Mixin&#x63A8;&#x8350;&#x6240;&#x6709;&#x6CE8;&#x5165;&#x65B9;&#x6CD5;&#x7684;&#x8BBF;&#x95EE;&#x7EA7;&#x90FD;&#x8BBE;&#x4E3A;<code>private</code>&#xFF08;&#x540C;&#x6837;&#x9002;&#x7528;&#x4E8E;&#x540E;&#x9762;&#x4ECB;&#x7ECD;&#x7684;&#x51E0;&#x4E2A;&#x6CE8;&#x89E3;&#xFF09;&#xFF0C;&#x5E76;&#x4E14;&#x5982;&#x679C;&#x76EE;&#x6807;&#x65B9;&#x6CD5;&#x662F;&#x9759;&#x6001;&#x65B9;&#x6CD5;&#xFF0C;&#x90A3;&#x4E48;&#x6CE8;&#x5165;&#x65B9;&#x6CD5;&#x4E5F;&#x5FC5;&#x987B;&#x662F;&#x9759;&#x6001;&#x65B9;&#x6CD5;&#x3002;<br>&#x88AB;<code>@Inject</code>&#x6807;&#x8BB0;&#x7684;&#x65B9;&#x6CD5;&#x6709;&#x5982;&#x4E0B;&#x8981;&#x6C42;&#xFF1A;</p>
</li>
<li>&#x8FD4;&#x56DE;&#x503C;&#x7C7B;&#x578B;&#x5FC5;&#x987B;&#x662F;<code>void</code></li>
<li>&#x6240;&#x6709;&#x5408;&#x6CD5;&#x7684;&#x65B9;&#x6CD5;&#x540D;&#x7686;&#x53EF;&#xFF0C;Mixin&#x5408;&#x5E76;&#x65F6;&#x4F1A;&#x91CD;&#x547D;&#x540D;&#x8FD9;&#x4E9B;&#x6CE8;&#x5165;&#x65B9;&#x6CD5;</li>
<li><p>&#x5982;&#x679C;&#x6709;&#x5FC5;&#x8981;&#xFF0C;&#x6CE8;&#x5165;&#x65B9;&#x6CD5;&#x53EF;&#x4EE5;&#x6DFB;&#x52A0;&#x76EE;&#x6807;&#x65B9;&#x6CD5;&#x7684;&#x53C2;&#x6570;&#xFF0C;&#x4E14;&#x5FC5;&#x987B;&#x52A0;&#x5728;&#x53C2;&#x6570;&#x5F00;&#x5934;&#xFF0C;&#x4E0E;&#x76EE;&#x6807;&#x65B9;&#x6CD5;&#x53C2;&#x6570;&#x7684;&#x987A;&#x5E8F;&#x548C;&#x7C7B;&#x578B;&#x5FC5;&#x987B;&#x4E00;&#x81F4;</p>
<p>&#x56E0;&#x6B64;&#xFF0C;&#x5982;&#x679C;&#x7528;<code>@Inject</code>&#x6CE8;&#x89E3;&#x8868;&#x793A;&#x4E0A;&#x8FF0;&#x4FEE;&#x6539;&#x65B9;&#x6848;&#x7684;&#x8BDD;&#xFF0C;&#x5E94;&#x8BE5;&#x50CF;&#x8FD9;&#x6837;&#xFF1A;</p>
<pre><code class="lang-java"><span class="hljs-keyword">package</span> com.example.mixins;

<span class="hljs-keyword">import</span> net.minecraft.client.Minecraft;
<span class="hljs-keyword">import</span> org.lwjgl.opengl.Display;
<span class="hljs-keyword">import</span> org.spongepowered.asm.mixin.Mixin;
<span class="hljs-keyword">import</span> org.spongepowered.asm.mixin.injection.At;
<span class="hljs-keyword">import</span> org.spongepowered.asm.mixin.injection.Inject;
<span class="hljs-keyword">import</span> org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

<span class="hljs-meta">@Mixin</span>(Minecraft.class)
<span class="hljs-keyword">public</span> <span class="hljs-keyword">abstract</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MixinMinecraft</span> </span>{
  <span class="hljs-comment">// &#x5982;&#x679C;&#x76EE;&#x6807;&#x65B9;&#x6CD5;&#x65E0;&#x8FD4;&#x56DE;&#x503C;&#x7C7B;&#x578B;&#xFF0C;&#x90A3;&#x4E48;&#x5728;&#x6DFB;&#x52A0;&#x76EE;&#x6807;&#x65B9;&#x6CD5;&#x53C2;&#x6570;&#x4E4B;&#x540E;&#x5FC5;&#x987B;&#x6709;&#x4E00;&#x4E2A;&#x53C2;&#x6570;&#xFF0C;&#x4E14;&#x5FC5;&#x987B;&#x662F; CallbackInfo &#x7C7B;&#x578B;&#x3002;</span>
  <span class="hljs-meta">@Inject</span>(
      method = <span class="hljs-string">&quot;createDisplay&quot;</span>,
      at = <span class="hljs-meta">@At</span>(
          value = <span class="hljs-string">&quot;INVOKE&quot;</span>, <span class="hljs-comment">// &#x8868;&#x793A;&#x6CE8;&#x5165;&#x5728;&#x65B9;&#x6CD5;&#x88AB;&#x8C03;&#x7528;&#x4E4B;&#x524D;</span>
          shift = At.Shift.AFTER, <span class="hljs-comment">// &#x628A;&#x6CE8;&#x5165;&#x70B9;&#x5F80;&#x540E;&#x79FB;&#x4E00;&#x4F4D;&#xFF0C;&#x4E5F;&#x5C31;&#x53D8;&#x6210;&#x6CE8;&#x5165;&#x5728;&#x65B9;&#x6CD5;&#x88AB;&#x8C03;&#x7528;&#x4E4B;&#x540E;</span>
          target = <span class="hljs-string">&quot;Lorg/lwjgl/opengl/Display;setTitle(Ljava/lang/String;)V&quot;</span>,
          remap = <span class="hljs-keyword">false</span> <span class="hljs-comment">// &lt;-- &#x56E0;&#x4E3A; Display.setTitle &#x5E76;&#x4E0D;&#x5B58;&#x5728;&#x4E8E;&#x6DF7;&#x6DC6;&#x8868;&#x4E2D;&#xFF0C;&#x6240;&#x4EE5;&#x8BBE;&#x7F6E; remap &#x5C5E;&#x6027;&#x4E3A; false</span>
      )
  )
  <span class="hljs-function"><span class="hljs-keyword">private</span> <span class="hljs-keyword">void</span> <span class="hljs-title">inject_createDisplay</span><span class="hljs-params">(CallbackInfo ci)</span> </span>{
      Display.setTitle(<span class="hljs-string">&quot;MyCustomTitle&quot;</span>);
      <span class="hljs-comment">// ci.cancel() // &lt;-- &#x5982;&#x679C;&#x8C03;&#x7528;&#x4E86; CallbackInfo::cancel &#xFF0C;&#x5C31;&#x8868;&#x793A;&#x6267;&#x884C;&#x5B8C;&#x6CE8;&#x5165;&#x65B9;&#x6CD5;&#x540E;&#x76EE;&#x6807;&#x65B9;&#x6CD5;&#x76F4;&#x63A5;return&#xFF0C;&#x4E0D;&#x518D;&#x6267;&#x884C;&#x539F;&#x65B9;&#x6CD5;&#x5269;&#x4F59;&#x7684;&#x4EE3;&#x7801;&#x3002;</span>
      <span class="hljs-comment">// cancel() &#x65B9;&#x6CD5;&#x80FD;&#x88AB;&#x8C03;&#x7528;&#x7684;&#x524D;&#x63D0;&#x662F;&#x5728; @Inject &#x91CC;&#x8BBE;&#x7F6E; cancellable &#x5C5E;&#x6027;&#x4E3A; true &#xFF0C;&#x5426;&#x5219;&#x4F1A;&#x629B;&#x51FA;&#x5F02;&#x5E38;&#x3002;</span>
  }
}
</code></pre>
<p>&#x5982;&#x679C;<code>@Inject</code>&#x6CE8;&#x5165;&#x7684;&#x662F;&#x5E26;&#x8FD4;&#x56DE;&#x503C;&#x7C7B;&#x578B;&#x7684;&#x65B9;&#x6CD5;&#xFF0C;&#x90A3;&#x4E48;&#x8DDF;&#x4E0A;&#x9762;&#x4ECB;&#x7ECD;&#x7684;&#x5C31;&#x4F1A;&#x6709;&#x6240;&#x5DEE;&#x522B;&#x3002; 
&#x5047;&#x8BBE;&#x6709;&#x4E00;&#x4E2A;&#x9700;&#x6C42;&#xFF1A;&#x5728;Minecraft&#x7A97;&#x4F53;&#x5904;&#x4E8E;&#x672A;&#x6FC0;&#x6D3B;&#x72B6;&#x6001;&#x65F6;&#xFF0C;&#x81EA;&#x52A8;&#x9501;&#x5B9A;&#x6BCF;&#x79D2;5&#x5E27;&#xFF08;&#x8FD9;&#x6837;&#x53EF;&#x4EE5;&#x6709;&#x6548;&#x964D;&#x4F4E;CPU&#x5360;&#x7528;&#xFF09;&#x3002;&#x5DF2;&#x77E5;&#x63A7;&#x5236;&#x6700;&#x5927;&#x5E27;&#x6570;&#x7684;&#x65B9;&#x6CD5;&#x662F;<code>Minecraft.getLimitFramerate</code>&#x3002;&#x90A3;&#x4E48;&#x5E94;&#x8BE5;&#x5199;&#x6210;&#x50CF;&#x4E0B;&#x9762;&#x8FD9;&#x6837;&#xFF1A;</p>
<pre><code class="lang-java"><span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">int</span> <span class="hljs-title">getLimitFramerate</span><span class="hljs-params">()</span> </span>{
  <span class="hljs-keyword">if</span> (!Display.isActive()) {
      <span class="hljs-keyword">return</span> <span class="hljs-number">5</span>;
  }
  <span class="hljs-keyword">return</span> <span class="hljs-keyword">this</span>.world == <span class="hljs-keyword">null</span> &amp;&amp; <span class="hljs-keyword">this</span>.currentScreen != <span class="hljs-keyword">null</span> ? <span class="hljs-number">30</span> : <span class="hljs-keyword">this</span>.gameSettings.limitFramerate;
}
</code></pre>
<p>&#x90A3;&#x4E48;&#x6211;&#x4EEC;&#x8BE5;&#x600E;&#x4E48;&#x7528;<code>@Inject</code>&#x6765;&#x8FBE;&#x6210;&#x6211;&#x4EEC;&#x7684;&#x76EE;&#x7684;&#x5462;&#xFF1F;</p>
<pre><code class="lang-java"><span class="hljs-keyword">package</span> com.example.mixins;

<span class="hljs-keyword">import</span> net.minecraft.client.Minecraft;
<span class="hljs-keyword">import</span> org.lwjgl.opengl.Display;
<span class="hljs-keyword">import</span> org.spongepowered.asm.mixin.Mixin;
<span class="hljs-keyword">import</span> org.spongepowered.asm.mixin.injection.At;
<span class="hljs-keyword">import</span> org.spongepowered.asm.mixin.injection.Inject;
<span class="hljs-keyword">import</span> org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

<span class="hljs-meta">@Mixin</span>(Minecraft.class)
<span class="hljs-keyword">public</span> <span class="hljs-keyword">abstract</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MixinMinecraft</span> </span>{
  <span class="hljs-comment">// &#x5BF9;&#x4E8E;&#x76EE;&#x6807;&#x65B9;&#x6CD5;&#x6709;&#x8FD4;&#x56DE;&#x503C;&#x7684;&#x60C5;&#x51B5;&#xFF0C;&#x5728;&#x6DFB;&#x52A0;&#x76EE;&#x6807;&#x65B9;&#x6CD5;&#x53C2;&#x6570;&#x4E4B;&#x540E;&#x4E00;&#x4E2A;&#x53C2;&#x6570;&#x5FC5;&#x987B;&#x662F; CallbackInfoReturnable &#x7C7B;&#x578B;&#xFF0C;&#x4E14;&#x6CDB;&#x578B;&#x7C7B;&#x578B;&#x5FC5;&#x987B;&#x662F;&#x76EE;&#x6807;&#x65B9;&#x6CD5;&#x7684;&#x8FD4;&#x56DE;&#x503C;&#x7C7B;&#x578B;&#xFF1B;</span>
  <span class="hljs-comment">// &#x5982;&#x679C;&#x672A;&#x8BBE;&#x7F6E; cancellable &#x4E3A; true &#x800C;&#x5F3A;&#x884C;&#x6267;&#x884C; cancel() &#x6216;&#x8005; setReturnValue() &#x65B9;&#x6CD5;&#xFF0C;&#x4F1A;&#x629B;&#x51FA; CancellationException &#x5F02;&#x5E38;</span>
  <span class="hljs-comment">// &#x5BF9;&#x4E8E; CallbackInfoReturnable &#x800C;&#x8A00;&#xFF0C;&#x5728; setReturnValue() &#x65B9;&#x6CD5;&#x4E2D;&#x5305;&#x542B;&#x4E86; cancel() &#x65B9;&#x6CD5;</span>
  <span class="hljs-meta">@Inject</span>(
      method = <span class="hljs-string">&quot;getLimitFramerate&quot;</span>,
      at = <span class="hljs-meta">@At</span>(<span class="hljs-string">&quot;HEAD&quot;</span>),
      cancellable = <span class="hljs-keyword">true</span>
  )
  <span class="hljs-function"><span class="hljs-keyword">private</span> <span class="hljs-keyword">void</span> <span class="hljs-title">inject_getLimitFramerate</span><span class="hljs-params">(CallbackInfoReturnable&lt;Integer&gt; cir)</span> </span>{
      <span class="hljs-keyword">if</span> (!Display.isActive()) {
          cir.setReturnValue(<span class="hljs-number">5</span>);
      }
  }
  <span class="hljs-comment">// &#x5728;&#x8C03;&#x7528; cir.setReturnValue() &#x4E4B;&#x524D;&#xFF1A;</span>
  <span class="hljs-comment">// &#x5982;&#x679C; @At.value &#x7684;&#x503C;&#x662F; RETURN &#x6216;&#x8005; TAIL &#xFF0C;&#x90A3;&#x4E48;&#x8C03;&#x7528; cir.getReturnValue() &#x65F6;&#x7684;&#x8FD4;&#x56DE;&#x503C;&#x5C31;&#x662F;&#x5728;&#x76EE;&#x6807;&#x65B9;&#x6CD5;&#x4E2D;&#x5373;&#x5C06;&#x8FD4;&#x56DE;&#x7684;&#x503C;&#xFF1B;&#x5BF9;&#x4E8E;&#x5176;&#x4ED6; @At.value &#x7684;&#x60C5;&#x51B5;&#xFF0C;&#x8C03;&#x7528;&#x5B83;&#x7684;&#x8FD4;&#x56DE;&#x503C;&#x90FD;&#x662F; null &#x3002;</span>
}
</code></pre>
<p>&#x8FD9;&#x6837;&#x6211;&#x4EEC;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x5C31;&#x7C7B;&#x4F3C;&#x4E8E;&#x6267;&#x884C;&#x4EE5;&#x4E0B;&#x4EE3;&#x7801;&#xFF08;&#x4E0D;&#x5B8C;&#x5168;&#x51C6;&#x786E;&#xFF09;&#xFF1A;</p>
<pre><code class="lang-java"><span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">int</span> <span class="hljs-title">getLimitFramerate</span><span class="hljs-params">()</span> </span>{
  CallbackInfoReturnable&lt;Integer&gt; cir = <span class="hljs-keyword">new</span> CallbackInfoReturnable&lt;&gt;(<span class="hljs-string">&quot;getLimitFramerate&quot;</span>, <span class="hljs-keyword">true</span>);
  <span class="hljs-keyword">this</span>.inject_getLimitFramerate(cir);
  <span class="hljs-keyword">if</span> (cir.isCancelled()) {
      <span class="hljs-keyword">return</span> cir.getReturnValue();
  }
  <span class="hljs-keyword">return</span> <span class="hljs-keyword">this</span>.world == <span class="hljs-keyword">null</span> &amp;&amp; <span class="hljs-keyword">this</span>.currentScreen != <span class="hljs-keyword">null</span> ? <span class="hljs-number">30</span> : <span class="hljs-keyword">this</span>.gameSettings.limitFramerate;
}
</code></pre>
<p><strong>&#x5982;&#x679C;&#x4F60;&#x60F3;&#x6CE8;&#x5165;&#x8005;&#x6784;&#x9020;&#x65B9;&#x6CD5;&#xFF0C;&#x90A3;&#x4E48;<code>at</code>&#x7684;&#x503C;&#x53EA;&#x80FD;&#x662F;<code>@At(&quot;RETURN&quot;)</code></strong></p>
<pre><code class="lang-java"><span class="hljs-meta">@Inject</span>(method = <span class="hljs-string">&quot;&lt;init&gt;&quot;</span>, at = <span class="hljs-meta">@At</span>(<span class="hljs-string">&quot;RETURN&quot;</span>))
<span class="hljs-comment">// &#x6784;&#x9020;&#x65B9;&#x6CD5;&#x53EA;&#x5141;&#x8BB8;&#x6CE8;&#x5165;&#x5230;&#x672B;&#x5C3E;&#xFF0C;&#x56E0;&#x4E3A;Mixin&#x9700;&#x8981;&#x4FDD;&#x8BC1;&#x8C03;&#x7528;&#x4F60;&#x7684;&#x65B9;&#x6CD5;&#x4E4B;&#x524D;&#x6574;&#x4E2A;&#x7C7B;&#x88AB;&#x5B8C;&#x6574;&#x5730;&#x521D;&#x59CB;&#x5316;</span>
</code></pre>
<p><code>@Inject</code>&#x4E5F;&#x5141;&#x8BB8;&#x6CE8;&#x5165;&#x65B9;&#x6CD5;&#x6355;&#x83B7;&#x76EE;&#x6807;&#x65B9;&#x6CD5;&#x5185;&#x7684;&#x5C40;&#x90E8;&#x53D8;&#x91CF;&#xFF0C;&#x8FD9;&#x53EF;&#x80FD;&#x6709;&#x4E9B;&#x590D;&#x6742;&#x3002;<br>&#x56E0;&#x4E3A;Minecraft&#x5728;&#x6DF7;&#x6DC6;&#x65F6;&#x62B9;&#x9664;&#x4E86;&#x6240;&#x6709;&#x65B9;&#x6CD5;&#x7684;&#x5C40;&#x90E8;&#x53D8;&#x91CF;&#x8868;&#xFF0C;&#x56E0;&#x6B64;Mixin&#x83B7;&#x5F97;&#x7684;&#x5C40;&#x90E8;&#x53D8;&#x91CF;&#x8868;&#x90FD;&#x662F;&#x6839;&#x636E;&#x65B9;&#x6CD5;&#x4F53;&#x7684;&#x5B57;&#x8282;&#x7801;<a href="https://github.com/SpongePowered/Mixin/blob/2c72246fe0b67c145db5510e66c8873df18b5a9f/src/main/java/org/spongepowered/asm/util/Locals.java#L328" target="_blank">&#x5206;&#x6790;</a>&#x51FA;&#x6765;&#x7684;&#xFF0C;&#x6240;&#x4EE5;&#x8FD9;&#x6837;&#x751F;&#x6210;&#x7684;&#x5C40;&#x90E8;&#x53D8;&#x91CF;&#x8868;&#x5F88;&#x5BB9;&#x6613;&#x88AB;&#x522B;&#x7684;&#x6A21;&#x7EC4;&#x4FEE;&#x6539;&#xFF0C;&#x6240;&#x4EE5;Mixin&#x5EFA;&#x8BAE;&#x614E;&#x7528;&#x5C40;&#x90E8;&#x53D8;&#x91CF;&#x6355;&#x83B7;&#x529F;&#x80FD;&#x3002;<br>&#x6211;&#x4EEC;&#x9700;&#x8981;&#x5B9A;&#x4E49;<code>@Inject</code>&#x5185;&#x7684;<code>locals</code>&#x53C2;&#x6570;&#xFF0C;&#x7C7B;&#x578B;&#x662F;<a href="http://jenkins.liteloader.com/job/Mixin/javadoc/org/spongepowered/asm/mixin/injection/callback/LocalCapture.html" target="_blank"><code>LocalCapture</code></a>&#xFF0C;&#x5B83;&#x662F;&#x4E00;&#x4E2A;&#x679A;&#x4E3E;&#x7C7B;&#x578B;&#xFF0C;&#x6709;&#x4EE5;&#x4E0B;&#x679A;&#x4E3E;&#x503C;&#xFF1A;</p>
</li>
<li><code>NO_CAPTURE</code>: &#x9ED8;&#x8BA4;&#x503C;&#xFF0C;&#x8868;&#x793A;&#x4E0D;&#x6355;&#x83B7;&#x5C40;&#x90E8;&#x53D8;&#x91CF;</li>
<li><code>PRINT</code>: &#x6355;&#x83B7;&#x5C40;&#x90E8;&#x53D8;&#x91CF;&#xFF0C;&#x4F46;&#x4E0D;&#x6CE8;&#x5165;&#x65B9;&#x6CD5;&#xFF0C;&#x4EC5;&#x5728;&#x63A7;&#x5236;&#x53F0;&#x6253;&#x5370;&#x5BF9;&#x5E94;&#x6CE8;&#x5165;&#x70B9;&#x53EF;&#x6355;&#x83B7;&#x7684;&#x5C40;&#x90E8;&#x53D8;&#x91CF;&#x8868;</li>
<li><code>CAPTURE_FAILSOFT</code>: &#x6355;&#x83B7;&#x5C40;&#x90E8;&#x53D8;&#x91CF;&#xFF0C;&#x5982;&#x679C;&#x6355;&#x83B7;&#x5931;&#x8D25;&#xFF0C;&#x4E0D;&#x6CE8;&#x5165;&#x8BE5;&#x65B9;&#x6CD5;&#xFF0C;&#x5728;&#x65E5;&#x5FD7;&#x4E2D;&#x8F93;&#x51FA;&#x4E00;&#x4E2A;&#x5F02;&#x5E38;</li>
<li><code>CAPTURE_FAILHARD</code>: &#x6355;&#x83B7;&#x5C40;&#x90E8;&#x53D8;&#x91CF;&#xFF0C;&#x5982;&#x679C;&#x6355;&#x83B7;&#x5931;&#x8D25;&#xFF0C;&#x629B;&#x51FA;&#x4E00;&#x4E2A;&#x9519;&#x8BEF;&#xFF0C;&#x7EC8;&#x6B62;&#x6E38;&#x620F;</li>
<li><p><code>CAPTURE_FAILEXCEPTION</code>: &#x6355;&#x83B7;&#x5C40;&#x90E8;&#x53D8;&#x91CF;&#xFF0C;&#x5982;&#x679C;&#x6355;&#x83B7;&#x5931;&#x8D25;&#xFF0C;&#x751F;&#x6210;&#x4E00;&#x4E2A;&#x5E26;&#x5F02;&#x5E38;&#x7684;&#x65B9;&#x6CD5;&#x5B58;&#x6839;&#xFF0C;&#x5E76;&#x5E94;&#x7528;&#x6CE8;&#x5165;</p>
<p>Mixin&#x5EFA;&#x8BAE;&#x7B2C;&#x4E00;&#x6B21;&#x6CE8;&#x5165;&#x8BE5;&#x65B9;&#x6CD5;&#x65F6;&#x5C06;<code>locals</code>&#x8BBE;&#x4E3A;<code>LocalCapture.PRINT</code>&#xFF0C;&#x4EE5;&#x4FBF;&#x786E;&#x5B9A;&#x5177;&#x4F53;&#x7684;&#x5C40;&#x90E8;&#x53D8;&#x91CF;&#x8868;&#x3002;<br>&#x6211;&#x4EEC;&#x4EE5;&#x4E0B;&#x9762;&#x8FD9;&#x6BB5;&#x4EE3;&#x7801;&#x4E3A;&#x4F8B;&#xFF1A;</p>
<pre><code class="lang-java"><span class="hljs-keyword">package</span> com.example.mixins;

<span class="hljs-keyword">import</span> net.minecraft.client.Minecraft;
<span class="hljs-keyword">import</span> org.spongepowered.asm.mixin.Mixin;
<span class="hljs-keyword">import</span> org.spongepowered.asm.mixin.injection.At;
<span class="hljs-keyword">import</span> org.spongepowered.asm.mixin.injection.Inject;
<span class="hljs-keyword">import</span> org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
<span class="hljs-keyword">import</span> org.spongepowered.asm.mixin.injection.callback.LocalCapture;

<span class="hljs-meta">@Mixin</span>(Minecraft.class)
<span class="hljs-keyword">public</span> <span class="hljs-keyword">abstract</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MixinMinecraft</span> </span>{
  <span class="hljs-meta">@Inject</span>(
      method = <span class="hljs-string">&quot;setWindowIcon&quot;</span>,
      at = <span class="hljs-meta">@At</span>(value = <span class="hljs-string">&quot;INVOKE&quot;</span>, target = <span class="hljs-string">&quot;Lnet/minecraft/client/resources/DefaultResourcePack;getInputStreamAssets(Lnet/minecraft/util/ResourceLocation;)Ljava/io/InputStream;&quot;</span>),
      locals = LocalCapture.PRINT
  )
  <span class="hljs-function"><span class="hljs-keyword">private</span> <span class="hljs-keyword">void</span> <span class="hljs-title">inject_setWindowIcon</span><span class="hljs-params">(CallbackInfo ci)</span> </span>{}
}
</code></pre>
<p>&#x5728;&#x5339;&#x914D;&#x5230;&#x6CE8;&#x5165;&#x70B9;&#x540E;&#xFF0C;&#x5C06;&#x4F1A;&#x5728;&#x63A7;&#x5236;&#x53F0;&#x8F93;&#x51FA;&#x4EE5;&#x4E0B;&#x4FE1;&#x606F;&#xFF08;&#x53EA;&#x4F1A;&#x8F93;&#x51FA;&#x5230;&#x63A7;&#x5236;&#x53F0;&#xFF0C;&#x5E76;&#x4E0D;&#x4F1A;&#x8F93;&#x51FA;&#x5230;&#x65E5;&#x5FD7;&#x4E2D;&#xFF09;&#xFF1A;&#xFF08;&#x8FD9;&#x4E2A;&#x4F1A;&#x8F93;&#x51FA;&#x4E24;&#x6B21;&#xFF0C;&#x56E0;&#x4E3A;&#x6709;&#x4E24;&#x4E2A;&#x5339;&#x914D;&#x70B9;&#xFF09;</p>
<pre><code>/***************************************************************************************************************************************************/
/*       Target Class : net.minecraft.client.Minecraft                                                                                             */
/*      Target Method : private void setWindowIcon()                                                                                               */
/*  Target Max LOCALS : 6                                                                                                                          */
/* Initial Frame Size : 1                                                                                                                          */
/*      Callback Name : handler$inject_setWindowIcon$zza000                                                                                        */
/*        Instruction : InjectionNode INVOKEVIRTUAL                                                                                                */
/***************************************************************************************************************************************************/
/*   LOCAL                  TYPE  NAME                                                                                                             */
/*   [  0]             Minecraft  this                                                                                                             */
/* &gt; [  1]           Util$EnumOS  util$enumos                                        &lt;capture&gt;                                                     */
/*   [  2]           InputStream  inputstream                                        &lt;capture&gt;                                                     */
/*   [  3]           InputStream  inputstream1                                       &lt;capture&gt;                                                     */
/*   [  4]                     -                                                                                                                   */
/*   [  5]                     -                                                                                                                   */
/***************************************************************************************************************************************************/
/*                                                                                                                                                 */
/* /**                                                                                                                                             */
/*  * Expected callback signature                                                                                                                  */
/*  * /                                                                                                                                            */
/* private void handler$inject_setWindowIcon$zza000(CallbackInfo ci, Util$EnumOS util$enumos, InputStream inputstream, InputStream inputstream1) { */
/*     // Method body                                                                                                                              */
/* }                                                                                                                                               */
/*                                                                                                                                                 */
/***************************************************************************************************************************************************/
</code></pre><p>&#x6CE8;&#x610F;&#x4E0B;&#x9762;&#x8F93;&#x51FA;&#x7684;<code>Expected callback signature</code>&#xFF0C;&#x8FD9;&#x4E2A;&#x5C31;&#x662F;Mixin&#x8BA4;&#x4E3A;&#x80FD;&#x6210;&#x529F;&#x6355;&#x83B7;&#x7684;&#x6CE8;&#x5165;&#x65B9;&#x6CD5;&#x7684;&#x65B9;&#x6CD5;&#x7B7E;&#x540D;&#xFF0C;&#x4E5F;&#x662F;&#x6CE8;&#x5165;&#x70B9;&#x6240;&#x5728;&#x7684;&#x4F5C;&#x7528;&#x57DF;&#x80FD;&#x4F7F;&#x7528;&#x7684;&#x6240;&#x6709;&#x7684;&#x5C40;&#x90E8;&#x53D8;&#x91CF;&#xFF0C;&#x6211;&#x4EEC;&#x53EA;&#x9700;&#x8981;&#x628A;&#x5B83;&#x8BA4;&#x4E3A;&#x5408;&#x9002;&#x7684;&#x65B9;&#x6CD5;&#x53C2;&#x6570;&#x590D;&#x5236;&#x5230;&#x6211;&#x4EEC;&#x6CE8;&#x5165;&#x65B9;&#x6CD5;&#x4E2D;&#xFF0C;&#x5E76;&#x6839;&#x636E;&#x9700;&#x6C42;&#x4FEE;&#x6539;&#x5408;&#x9002;&#x7684;<code>locals</code>&#x7684;&#x503C;&#x5373;&#x53EF;&#xFF1A;</p>
<pre><code class="lang-java"><span class="hljs-meta">@Inject</span>(
  method = <span class="hljs-string">&quot;setWindowIcon&quot;</span>,
  at = <span class="hljs-meta">@At</span>(value = <span class="hljs-string">&quot;INVOKE&quot;</span>, target = <span class="hljs-string">&quot;Lnet/minecraft/client/resources/DefaultResourcePack;getInputStreamAssets(Lnet/minecraft/util/ResourceLocation;)Ljava/io/InputStream;&quot;</span>),
  locals = LocalCapture.CAPTURE_FAILSOFT
)
<span class="hljs-function"><span class="hljs-keyword">private</span> <span class="hljs-keyword">void</span> <span class="hljs-title">inject_setWindowIcon</span><span class="hljs-params">(CallbackInfo ci, Util.EnumOS util$enumos, InputStream inputstream, InputStream inputstream1)</span> </span>{}
<span class="hljs-comment">// &#x6211;&#x4EEC;&#x4E0D;&#x4E00;&#x5B9A;&#x8981;&#x628A;&#x9884;&#x671F;&#x53C2;&#x6570;&#x5168;&#x586B;&#x4E0A;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x53EA;&#x9009;&#x62E9;&#x524D;&#x51E0;&#x4E2A;&#xFF0C;&#x6BD4;&#x5982;&#xFF1A;</span>
<span class="hljs-comment">// private void inject_setWindowIcon(CallbackInfo ci, Util.EnumOS util$enumos, InputStream inputstream)</span>
<span class="hljs-comment">// private void inject_setWindowIcon(CallbackInfo ci, Util.EnumOS util$enumos)</span>
<span class="hljs-comment">// &#x4E0A;&#x9762;&#x8FD9;&#x4E24;&#x4E2A;&#x4E5F;&#x662F;&#x7B26;&#x5408;&#x8981;&#x6C42;&#x5E76;&#x80FD;&#x6210;&#x529F;&#x6CE8;&#x5165;&#x7684;</span>
</code></pre>
<p>&#x6709;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x6211;&#x4EEC;&#x4E8B;&#x5148;&#x5DF2;&#x7ECF;&#x77E5;&#x9053;&#x67D0;&#x4E9B;&#x975E;&#x5E38;&#x6D41;&#x884C;&#x7684;&#x6A21;&#x7EC4;&#x4F1A;&#x5BF9;&#x76EE;&#x6807;&#x65B9;&#x6CD5;&#x7684;&#x5C40;&#x90E8;&#x53D8;&#x91CF;&#x8868;&#x8FDB;&#x884C;&#x66F4;&#x6539;&#xFF0C;&#x6216;&#x8005;&#x662F;&#x5339;&#x914D;&#x591A;&#x4E2A;&#x4F4D;&#x7F6E;&#x65F6;&#x6BCF;&#x4E2A;&#x4F4D;&#x7F6E;&#x7684;&#x53EF;&#x7528;&#x5C40;&#x90E8;&#x53D8;&#x91CF;&#x4E0D;&#x540C;&#xFF0C;&#x8FD9;&#x4E2A;&#x65F6;&#x5019;Mixin&#x5141;&#x8BB8;&#x5BF9;&#x6CE8;&#x5165;&#x65B9;&#x6CD5;&#x8FDB;&#x884C;&#x91CD;&#x8F7D;&#xFF0C;&#x5E76;&#x52A0;&#x4E0A;&#x4E0B;&#x9762;&#x8FD9;&#x4E2A;&#x6CE8;&#x89E3;&#xFF1A;</p>
</li>
<li><p><code>@Surrogate</code>&#xFF08;<a href="http://jenkins.liteloader.com/job/Mixin/javadoc/org/spongepowered/asm/mixin/injection/Surrogate.html" target="_blank">&#x6587;&#x6863;</a>&#xFF09;</p>
<p>&#x4F46;&#x662F;&#x51FA;&#x4E8E;&#x67D0;&#x4E9B;&#x5947;&#x602A;&#x7684;<a href="https://github.com/SpongePowered/Mixin/blob/2c72246fe0b67c145db5510e66c8873df18b5a9f/src/main/java/org/spongepowered/asm/mixin/injection/callback/CallbackInjector.java#L198" target="_blank">&#x539F;&#x56E0;</a>&#xFF0C;<code>@Surrogate</code>&#x65B9;&#x6CD5;&#x7684;&#x53C2;&#x6570;&#x4E2A;&#x6570;&#x4E0D;&#x80FD;&#x591A;&#x4E8E;<code>@Inject</code>&#x65B9;&#x6CD5;&#xFF0C;&#x56E0;&#x6B64;&#x6211;&#x5EFA;&#x8BAE;&#x628A;&#x53C2;&#x6570;&#x4E2A;&#x6570;&#x6700;&#x591A;&#x7684;&#x65B9;&#x6CD5;&#x6807;&#x8BB0;&#x4E3A;<code>@Inject</code>&#xFF0C;&#x5176;&#x4F59;&#x91CD;&#x8F7D;&#x65B9;&#x6CD5;&#x6807;&#x8BB0;&#x4E3A;<code>@Surrogate</code>&#xFF0C;&#x6B64;&#x65F6;&#x7684;<code>@Surrpgate</code>&#x65B9;&#x6CD5;&#x53C2;&#x6570;&#x5FC5;&#x987B;&#x5305;&#x542B;&#x6240;&#x6709;&#x53EF;&#x7528;&#x7684;&#x5C40;&#x90E8;&#x53D8;&#x91CF;&#xFF0C;&#x800C;&#x4E0D;&#x80FD;&#x4EC5;&#x6709;&#x524D;&#x51E0;&#x4E2A;&#x3002;
&#x5047;&#x5982;&#x6709;&#x4E00;&#x4E2A;&#x6A21;&#x7EC4;&#x5BF9;<code>setWindowIcon</code>&#x7684;&#x6CE8;&#x5165;&#x70B9;&#x7684;&#x4F5C;&#x7528;&#x57DF;&#x52A0;&#x4E86;&#x4E24;&#x4E2A;int&#x7C7B;&#x578B;&#x7684;&#x5C40;&#x90E8;&#x53D8;&#x91CF;&#xFF0C;&#x5982;&#x679C;&#x6DFB;&#x52A0;&#x4E86;&#x8FD9;&#x4E2A;&#x6A21;&#x7EC4;&#xFF0C;&#x90A3;&#x4E48;&#x5C40;&#x90E8;&#x53D8;&#x91CF;&#x7C7B;&#x578B;&#x5C31;&#x4F1A;&#x53D8;&#x6210;<code>Minecraft</code>&#x3001;<code>int</code>&#x3001;<code>int</code>&#x3001;<code>Util$EnumOS</code>&#x3001;<code>InputStream</code>&#x3001;<code>InputStream</code>&#xFF0C;&#x90A3;&#x4E48;&#x6211;&#x4EEC;&#x81EA;&#x5DF1;&#x7684;&#x6A21;&#x7EC4;&#x5C31;&#x5E94;&#x8BE5;&#x8FD9;&#x6837;&#x5199;&#xFF1A;</p>
<pre><code class="lang-java"><span class="hljs-meta">@Inject</span>(
  method = <span class="hljs-string">&quot;setWindowIcon&quot;</span>,
  at = <span class="hljs-meta">@At</span>(value = <span class="hljs-string">&quot;INVOKE&quot;</span>, target = <span class="hljs-string">&quot;Lnet/minecraft/client/resources/DefaultResourcePack;getInputStreamAssets(Lnet/minecraft/util/ResourceLocation;)Ljava/io/InputStream;&quot;</span>),
  locals = LocalCapture.CAPTURE_FAILSOFT
)
<span class="hljs-function"><span class="hljs-keyword">private</span> <span class="hljs-keyword">void</span> <span class="hljs-title">inject_setWindowIcon</span><span class="hljs-params">(CallbackInfo ci, <span class="hljs-keyword">int</span> i, <span class="hljs-keyword">int</span> j, Util.EnumOS util$enumos, InputStream inputstream, InputStream inputstream1)</span> </span>{}

<span class="hljs-meta">@Surrogate</span>
<span class="hljs-function"><span class="hljs-keyword">private</span> <span class="hljs-keyword">void</span> <span class="hljs-title">inject_setWindowIcon</span><span class="hljs-params">(CallbackInfo ci, Util.EnumOS util$enumos, InputStream inputstream, InputStream inputstream1)</span> </span>{}

<span class="hljs-meta">@Surrogate</span>
<span class="hljs-function"><span class="hljs-keyword">private</span> <span class="hljs-keyword">void</span> <span class="hljs-title">inject_setWindowIcon</span><span class="hljs-params">(CallbackInfo ci, Util.EnumOS util$enumos, InputStream inputstream, InputStream inputstream1, CallbackInfo ci1)</span> </span>{}
<span class="hljs-comment">// &#x6CE8;&#x610F;&#x8FD9;&#x4E2A;&#x65B9;&#x6CD5;&#x53C2;&#x6570;&#x4F1A;&#x591A;&#x51FA;&#x4E00;&#x4E2A; CallbackInfo &#xFF0C;&#x56E0;&#x4E3A;&#x8FD9;&#x4E2A;&#x4F8B;&#x5B50;&#x4E0B;&#x6307;&#x5B9A;&#x7684; @Inject.at &#x4F1A;&#x5728;&#x76EE;&#x6807;&#x65B9;&#x6CD5;&#x91CC;&#x5339;&#x914D;&#x4E24;&#x6B21;&#xFF0C;&#x800C;&#x4E14;&#x8FD9;&#x4E24;&#x6B21;&#x6070;&#x597D;&#x5728;&#x540C;&#x4E00;&#x4F5C;&#x7528;&#x57DF;&#x5F53;&#x4E2D;&#xFF0C;&#x6240;&#x4EE5;&#x540E;&#x9762;&#x7684; CallbackInfo &#x6B63;&#x662F;&#x5339;&#x914D;&#x7B2C;&#x4E00;&#x6B21;&#x65F6;&#x7684;&#x90A3;&#x4E2A;&#x3002;</span>

<span class="hljs-comment">//@Surrogate private void inject_setWindowIcon(CallbackInfo ci, int i, int j, Util.EnumOS util$enumos, InputStream inputstream, InputStream inputstream1, CallbackInfo ci1) {}</span>
<span class="hljs-comment">// &#x8FD9;&#x4E2A;&#x65B9;&#x6CD5;&#x4E0D;&#x4F1A;&#x88AB;&#x5339;&#x914D;&#x5230;&#xFF0C;&#x56E0;&#x4E3A; @Surrogate &#x65B9;&#x6CD5;&#x7684;&#x53C2;&#x6570;&#x4E2A;&#x6570;&#x4E0D;&#x4F1A;&#x591A;&#x4E8E; @Inject &#x65B9;&#x6CD5;&#x7684;&#x53C2;&#x6570;&#x4E2A;&#x6570;</span>
</code></pre>
<p>&#x4E4B;&#x524D;&#x8BF4;&#x5230;<code>@Inject</code>&#x4E2D;&#x7684;<code>require</code>&#x548C;<code>allow</code>&#x53EF;&#x4EE5;&#x68C0;&#x67E5;&#x5339;&#x914D;&#x6B21;&#x6570;&#xFF0C;&#x4F46;&#x662F;&#x8FD9;&#x662F;&#x68C0;&#x67E5;<code>@Inject</code>&#x65B9;&#x6CD5;&#x548C;&#x4E0E;&#x8FD9;&#x4E2A;&#x65B9;&#x6CD5;&#x9644;&#x5E26;&#x7684;&#x6240;&#x6709;<code>@Surrogate</code>&#x65B9;&#x6CD5;&#x7684;&#x603B;&#x5171;&#x7684;&#x5339;&#x914D;&#x6B21;&#x6570;&#x7684;&#x3002;<br>&#x5982;&#x679C;&#x4F60;&#x60F3;&#x5BF9;&#x67D0;&#x4E2A;&#x7684;<code>@Inject</code>&#x65B9;&#x6CD5;&#x6216;&#x8005;<code>@Surrogate</code>&#x65B9;&#x6CD5;&#x5355;&#x72EC;&#x5B89;&#x6392;&#x68C0;&#x67E5;&#x5339;&#x914D;&#x6B21;&#x6570;&#xFF0C;&#x53EF;&#x4EE5;&#x5728;&#x5BF9;&#x5E94;&#x7684;&#x65B9;&#x6CD5;&#x4E0A;&#x6DFB;&#x52A0;&#x4E0B;&#x9762;&#x8FD9;&#x4E2A;&#x6CE8;&#x89E3;&#xFF1A;</p>
</li>
<li><p><code>@Group</code>&#xFF08;<a href="http://jenkins.liteloader.com/job/Mixin/javadoc/org/spongepowered/asm/mixin/injection/Group.html" target="_blank">&#x6587;&#x6863;</a>&#xFF09;</p>
<ul>
<li><code>name</code>: &#x540D;&#x79F0;&#xFF08;&#x62A5;&#x9519;&#x65F6;&#x4F1A;&#x5728;&#x65E5;&#x5FD7;&#x4E2D;&#x663E;&#x793A;&#xFF09;</li>
<li><code>min</code>: &#x540C;<code>@Inject.require</code></li>
<li><code>max</code>: &#x540C;<code>@Inject.allow</code></li>
</ul>
<p>&#x4F8B;&#x5982;&#xFF1A;</p>
<pre><code class="lang-java"><span class="hljs-meta">@Surrogate</span> <span class="hljs-meta">@Group</span>(max = <span class="hljs-number">1</span>) <span class="hljs-comment">// &#x4E0D;&#x4F1A;&#x62A5;&#x9519;&#xFF0C;&#x56E0;&#x4E3A;&#x8FD9;&#x4E2A;&#x65B9;&#x6CD5;&#x6700;&#x591A;&#x53EA;&#x80FD;&#x5339;&#x914D;&#x5230;&#x4E00;&#x6B21;</span>
<span class="hljs-function"><span class="hljs-keyword">private</span> <span class="hljs-keyword">void</span> <span class="hljs-title">inject_setWindowIcon</span><span class="hljs-params">(CallbackInfo ci, Util.EnumOS util$enumos, InputStream inputstream, InputStream inputstream1)</span> </span>{}

<span class="hljs-meta">@Inject</span>(
  method = <span class="hljs-string">&quot;setWindowIcon&quot;</span>,
  at = <span class="hljs-meta">@At</span>(value = <span class="hljs-string">&quot;INVOKE&quot;</span>, target = <span class="hljs-string">&quot;Lnet/minecraft/client/resources/DefaultResourcePack;getInputStreamAssets(Lnet/minecraft/util/ResourceLocation;)Ljava/io/InputStream;&quot;</span>),
  locals = LocalCapture.CAPTURE_FAILSOFT,
  require = <span class="hljs-number">2</span> <span class="hljs-comment">// &#x4E0D;&#x4F1A;&#x62A5;&#x9519;&#xFF0C;&#x56E0;&#x4E3A;&#x4E24;&#x4E2A;&#x65B9;&#x6CD5;&#x603B;&#x5171;&#x6700;&#x5C11;&#x80FD;&#x5339;&#x914D;&#x5230;&#x4E24;&#x6B21;</span>
)
<span class="hljs-function"><span class="hljs-keyword">private</span> <span class="hljs-keyword">void</span> <span class="hljs-title">inject_setWindowIcon</span><span class="hljs-params">(CallbackInfo ci, Util.EnumOS util$enumos, InputStream inputstream, InputStream inputstream1, CallbackInfo ci1)</span> </span>{}
</code></pre>
</li>
</ul>
</li>
</ul>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="5.2.html" class="navigation navigation-prev " aria-label="Previous page: 引导">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="5.4.html" class="navigation navigation-next " aria-label="Next page: 修改">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"注入","level":"1.8.3","depth":2,"next":{"title":"修改","level":"1.8.4","depth":2,"path":"5.4.md","ref":"5.4.md","articles":[]},"previous":{"title":"引导","level":"1.8.2","depth":2,"path":"5.2.md","ref":"5.2.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"5.3.md","mtime":"2019-09-08T00:42:29.873Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-09-08T04:47:05.818Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

